想以宏撷取外部资料,录制以下动作:
资料->现有连线->选取iqy档->选择储存格位置->停止录制
结果重新执行时出现以下错误讯息:
执行阶段错误'5'
程序呼叫或引数不正确
究竟是哪出错了?
附上程式码
Sub 宏1()
'
' 宏1 宏
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;C:\Users\jamesle\Desktop\TTTTFFFF.iqy",
Destination:=Range("$A$1"))
.CommandType = 0
.Name = "TTTTFFFF"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = """tb"""
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub