作者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