[算表] 用巨集功能結果出現執行階段錯誤"5"

看板Office作者 (ching)時間13年前 (2013/03/07 11:20), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
軟體:excel 版本:2013 第一次使用巨集功能,結果在執行巨集的時候卻出現:執行階段錯誤"5"程序 Sub L() ' ' L 巨集 ' ' 快速鍵: Ctrl+Shift+Q ' With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:\Users\Pan\Desktop\111\1.", Destination:=Range("$A$1")) .CommandType = 0 .Name = "1." .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 950 .TextFileStartRow = 1 .TextFileParseType = xlFixedWidth .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(1, 1, 1) .TextFileFixedColumnWidths = Array(8, 37) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With End Sub 請問我該如何排除這個問題呢><? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 1.168.1.46

03/07 14:36, , 1F
將CommandType這一列刪除試試
03/07 14:36, 1F

03/07 18:03, , 2F
CommandType沒有值為0的? xlCmdCube=1 xlCmdDefault=4
03/07 18:03, 2F

03/07 18:03, , 3F
xlCmdList=5 xlCmdSql=2 xlCmdTable=3
03/07 18:03, 3F
文章代碼(AID): #1HE0T_Dz (Office)
文章代碼(AID): #1HE0T_Dz (Office)