首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行时错误5宏中的过程调用无效

运行时错误5宏中的过程调用无效
EN

Stack Overflow用户
提问于 2016-03-07 22:16:45
回答 1查看 1.1K关注 0票数 0

我正在尝试使用宏导入文本文件,但我好像收到了错误5,无效的过程调用。我尝试录制宏并重新运行,但在“命令类型”行显示该错误。我找不到原因。任何帮助我们都将不胜感激

代码语言:javascript
复制
Sub Macro1()
'
' Macro1 Macro
'

'
Application.DisplayAlerts = False
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;C:\Users\491840\Desktop\IE11 scripts link.txt", Destination:=Range( _
        "$A$1"))
        .CommandType = 0
        .Name = "IE11 scripts link"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 437
        .TextFileStartRow = 1
        .TextFileParseType = xlFixedWidth
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = True
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
        .TextFileFixedColumnWidths = Array(10, 17, 21, 16)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
Application.DisplayAlerts = True

End Sub
EN

回答 1

Stack Overflow用户

发布于 2016-03-07 22:50:23

我认为它正在尝试执行一个文件类型不兼容的进程。尝试删除commmandtype行,然后重新运行。希望这能行得通

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35846017

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档