因公司需求我做了了一張表單,但現都顯示"此處需要物件"可以請各位熟手幫幫忙看一下如何修正嗎?
Dim D As String
Dim T As String
T = Left(ActiveWorkbook.Name, 5) + "檢查\"
If TextBox5.Text = "" And Not (TextBox6.Text = "") Then
If IsDate(TextBox6.Text) And TextBox6.TextLength = 9 Then
Cells(4, "E") = "訂單編號:" & TextBox1.Text
Cells(5, "F") = TextBox2.Text
Cells(4, "H") = TextBox3.Text
Cells(5, "H") = TextBox4.Text
Cells(4, "J") = TextBox5.Text
Cells(5, "J") = TextBox6.Text
MsgBox "資料輸入成功"
E = Left(ActiveWorkbook.Name, 20)
D = E + "_進料檢驗表單_Range(B5)--" + Left(TextBox6.Text, 3) + Mid(TextBox6.Text, 5, 2) + Mid(TextBox6.Text, 8, 2) + "生產(" + TextBox1.Text + "--" + TextBox2.Text + "-" + TextBox4.Text + ")"
ActiveWorkbook.SaveAs Filename:="\\Charmingal\品檢\C\031\3\" + T + D & xlBook.xlSheet.Range(D) & ".xls"
Workbooks(ActiveWorkbook.Name).SaveAs "\\Charmingal\品檢\C\031\3\" + T + D
QC_FORM.Hide
Else
MsgBox "日期錯誤!!"
End If
End If
If TextBox6.Text = "" And Not (TextBox5.Text = "") Then
If IsDate(TextBox5.Text) And TextBox5.TextLength = 9 Then
Cells(4, "E") = "訂單編號:" & TextBox1.Text
Cells(5, "F") = TextBox2.Text
Cells(4, "H") = TextBox3.Text
Cells(5, "H") = TextBox4.Text
Cells(4, "J") = TextBox5.Text
Cells(5, "J") = TextBox6.Text
MsgBox "資料輸入成功"
E = Left(ActiveWorkbook.Name, 20)
D = E + "_進料檢驗表單_RimProfile--" + Left(TextBox6.Text, 3) + Mid(TextBox6.Text, 5, 2) + Mid(TextBox6.Text, 8, 2) + "生產(" + TextBox1.Text + "--" + TextBox2.Text + "-" + TextBox4.Text + ")"
ActiveWorkbook.SaveAs Filename:="\\Charmingal\品檢\C\031\3\" + T + D & xlBook.xlSheet.Range(D) & ".xls"
Workbooks(ActiveWorkbook.Name).SaveAs "\\Charmingal\品檢\C\031\3\" + T + D
QC_FORM.Hide
Else
MsgBox "進貨日期錯誤!!"
End If
End If
If TextBox6.Text = "" And TextBox5.Text = "" Then
Cells(4, "E") = "訂單編號:" & TextBox1.Text
Cells(5, "F") = TextBox2.Text
Cells(4, "H") = TextBox3.Text
Cells(5, "H") = TextBox4.Text
Cells(4, "J") = TextBox5.Text
Cells(5, "J") = TextBox6.Text
MsgBox "資料輸入成功"
E = Left(ActiveWorkbook.Name, 20)
D = E + "_進料檢驗表單_RimProfile--" + Left(TextBox6.Text, 3) + Mid(TextBox6.Text, 5, 2) + Mid(TextBox6.Text, 8, 2) + "生產(" + TextBox1.Text + "--" + TextBox2.Text + "-" + TextBox4.Text + ")"
Workbooks(ActiveWorkbook.Name).SaveAs "\\Charmingal\品檢\C\031\3\" + T + D
QC_FORM.Hide
End If
If Not (TextBox6.Text = "") And Not (TextBox5.Text = "") Then
If IsDate(TextBox5.Text) And TextBox5.TextLength = 9 And IsDate(TextBox6.Text) And TextBox6.TextLength = 9 Then
Cells(4, "E") = "訂單編號:" & TextBox1.Text
Cells(5, "F") = TextBox2.Text
Cells(4, "H") = TextBox3.Text
Cells(5, "H") = TextBox4.Text
Cells(4, "J") = TextBox5.Text
Cells(5, "J") = TextBox6.Text
MsgBox "資料輸入成功"
E = Left(ActiveWorkbook.Name, 20)
D = E + "_進料檢驗表單_Range(B5)--" + Left(TextBox6.Text, 3) + Mid(TextBox6.Text, 5, 2) + Mid(TextBox6.Text, 8, 2) + "生產(" + TextBox1.Text + "--" + TextBox2.Text + "-" + TextBox4.Text + ")"
xlBook.SaveAs Filename:="\\Charmingal\品檢\C\031\3\" + T + D & xlBook.xlSheet.Range("D") & ".xls"
Workbooks(ActiveWorkbook.Name).SaveAs "\\Charmingal\品檢\C\031\3\" + T + D
QC_FORM.Hide
Else
MsgBox "日期錯誤!!"
End If
End If