標題:
[發問]
請問要如何設定讓巨集忽略錯誤,繼續跳下一個執行(以解決)
[打印本頁]
作者:
棋語鳥鳴
時間:
2011-7-3 17:11
標題:
請問要如何設定讓巨集忽略錯誤,繼續跳下一個執行(以解決)
本帖最後由 棋語鳥鳴 於 2011-7-15 19:34 編輯
Sub Macro1()
'
' Macro1 Macro
'
'
Workbooks.OpenText Filename:= _
Range("C4"), Origin:= _
950, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, Comma:=False, _
Space:=True, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3 _
, 1), Array(4, 1), Array(5, 1), Array(6, 1)), TrailingMinusNumbers:=True
ActiveWindow.SmallScroll Down:=15
Range("F32:G40").Select
Selection.Copy
Windows("test.xlsb").Activate
Sheets("sample1 (1)").Select
Range("B2").Select
ActiveSheet.Paste
Windows("Report.TXT").Activate
ActiveWindow.Close
Sheets("set print").Select
Range("B1").Select
Workbooks.OpenText Filename:= _
Range("C5"), Origin:= _
950, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, Comma:=False, _
Space:=True, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3 _
, 1), Array(4, 1), Array(5, 1), Array(6, 1)), TrailingMinusNumbers:=True
ActiveWindow.SmallScroll Down:=15
Range("F32:G40").Select
Selection.Copy
Windows("test.xlsb").Activate
Sheets("sample1 (2)").Select
Range("B2").Select
ActiveSheet.Paste
Windows("Report.TXT").Activate
ActiveWindow.Close
Sheets("set print").Select
Range("B1").Select
Workbooks.OpenText Filename:= _
Range("C6"), Origin:= _
950, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, Comma:=False, _
Space:=True, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3 _
, 1), Array(4, 1), Array(5, 1), Array(6, 1)), TrailingMinusNumbers:=True
ActiveWindow.SmallScroll Down:=15
Range("F32:G40").Select
Selection.Copy
Windows("test.xlsb").Activate
Sheets("sample1 (3)").Select
Range("B2").Select
ActiveSheet.Paste
Windows("Report.TXT").Activate
ActiveWindow.Close
Sheets("set print").Select
Range("B1").Select
End Sub
複製代碼
請問要如何讓此段巨集,出現錯誤時,忽略錯誤,繼續跳下一行執行,不要跳出除錯視窗???
感謝"a8350070" 大大指導~~
作者:
a8350070
時間:
2011-7-3 18:44
On Error Resume Next '不偵錯
Macro......
On Error GoTo 0 '回復偵錯
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)