[VBA ] 錄製巨集結取外部資料失敗

看板Visual_Basic作者 (....N )時間12年前 (2013/08/02 13:37), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
想以巨集擷取外部資料,錄製以下動作: 資料->現有連線->選取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)

08/06 06:44, , 1F
根據我的經驗,可能是設定引用項目沒有設定好
08/06 06:44, 1F
文章代碼(AID): #1H-qMXOf (Visual_Basic)
文章代碼(AID): #1H-qMXOf (Visual_Basic)