Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Run-time Error '-2147417848 (80010108)'

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:\D ata\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




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Run-time Error '-2147417848 (80010108)'

hi
i think it's because you have the refreshperiod set to zero. this is the
amout of time in minutes allowed between refreshes. in your case you create
the query which brings the data in then you want to refresh the data
immediately again and with refreshperiod set to zero, i don't think you can
do that.

but more puzzling is why are you creating a new query each time. i see the
workbook add line but this would create a new query in each workbook????
once created, excel remembers the query, assigns in a named range name and
remembers all of the query properties. after that all you need to do is
refresh the query and one line of code would do it.

range("A1").querytable.refresh backgroundquery:=false

I never recomend a background query. has the potential to screw other things
up.

if you are wanting to save a copy of the query run, just save the data which
would not be refreshable instead of creating a new, refreshable query. you
would use less disk space that way.

regards
FSt1

"mrsviqt" wrote:

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:\D ata\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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Time Error 2147417848 - 80010108 method Copy of Object Range F RonKay Excel Programming 1 October 19th 07 06:36 AM
Runtime Error '-2147417848 (80010108)' Ian Excel Programming 3 February 19th 07 02:22 PM
Macro does not work after the program has been restarted in excel.Run time error 2147417848 (80010108) Method visible of object_worksheet failed [email protected] Excel Programming 7 August 24th 05 03:11 PM
Excel Bug: Run-time error '-2147417848 (80010108)' majikman[_18_] Excel Programming 1 May 13th 04 08:16 PM
Run time error 2147417848(80010108) Praveen Excel Programming 4 December 18th 03 10:23 AM


All times are GMT +1. The time now is 07:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"