我正在尝试使用宏导入文本文件,但我好像收到了错误5,无效的过程调用。我尝试录制宏并重新运行,但在“命令类型”行显示该错误。我找不到原因。任何帮助我们都将不胜感激
Sub Macro1()
'
' Macro1 Macro
'
'
Application.DisplayAlerts = False
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Users\491840\Desktop\IE11 scripts link.txt", Destination:=Range( _
"$A$1"))
.CommandType = 0
.Name = "IE11 scripts link"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(10, 17, 21, 16)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Application.DisplayAlerts = True
End Sub发布于 2016-03-07 22:50:23
我认为它正在尝试执行一个文件类型不兼容的进程。尝试删除commmandtype行,然后重新运行。希望这能行得通
https://stackoverflow.com/questions/35846017
复制相似问题