有人可以帮我解决这个问题吗:
我在 workbook1 中有一个宏。我要做的是
'打开workbook2.txt
Workbooks.OpenText filename:= _
"workbook2.txt", Origin:=437, StartRow _
:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=True _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), _
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), _
Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15, 1)), _
TrailingMinusNumbers:=True
' copy a range
Dim test As Range
Set test= Range("G971:M1000")
'close workbook2
Workbooks("workbook2").Close
'copy test in workbook1
Windows("workbook1.xlsm").Activate
Sheets("Sheet1").Select
Range("B3").Select
Selection.PasteSpecial Paste:=test, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
这会导致运行时错误 1004。
这将是非常好的人来帮助。