作者redmist (....N )
看板Visual_Basic
标题[VBA ] 录制巨集结取外部资料失败
时间Fri Aug 2 13:37:34 2013
想以巨集撷取外部资料,录制以下动作:
资料->现有连线->选取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
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.36.69.170
※ 编辑: redmist 来自: 114.36.69.170 (08/02 13:39)
1F:→ s06yji3:根据我的经验,可能是设定引用项目没有设定好 08/06 06:44