M
mrsviqt
I have a macro that is doing a number of things, starting with importing a
txt file. When I try to run it, I get this error: "Run-time Error
'-2147417848 (80010108)' Automation Error The object invoked has
disconnected from its clients.
When I Debug. it goes to the following line within the code ".Refresh
BackgroundQuery:=False" I have tried everything I know to fix it (granted,
that is not very much). Below is the code.
Any help would be appreciated. Thanks in advance.
Workbooks.Add
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\Data\SALES.TXT", _
Destination:=Range("A1"))
.Name = "SALES"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = -536
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(2, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(26, 14, 7, 11, 1, 17, 17, 8, 3)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
txt file. When I try to run it, I get this error: "Run-time Error
'-2147417848 (80010108)' Automation Error The object invoked has
disconnected from its clients.
When I Debug. it goes to the following line within the code ".Refresh
BackgroundQuery:=False" I have tried everything I know to fix it (granted,
that is not very much). Below is the code.
Any help would be appreciated. Thanks in advance.
Workbooks.Add
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\Data\SALES.TXT", _
Destination:=Range("A1"))
.Name = "SALES"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = -536
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(2, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(26, 14, 7, 11, 1, 17, 17, 8, 3)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub