LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Refresh BackgroundQuery fails

I have a macro that imports data from an exported text file. And it works
like it is supposed to on a bunch of computers, except the customers. This
is my code:
With ActiveSheet.QueryTables.Add(Connection:= strImportFullName,
Destination:=Range("A1"))
.Name = "INVENT"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
'define the DataTypes to be TEXT:
' .TextFileColumnDataTypes = Array(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, _
' 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 _
' , 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, _
' 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)
' .Refresh BackgroundQuery:=False
'DataTypes:
'1 General
'2 Text
'3 Date DYM
'4 Date DMY
'5 Date YMD
'6 Date MYD
'7 Date DYM
'8 Date YDM
'9 Skip
.TextFileColumnDataTypes = rayImportArray
.Refresh BackgroundQuery:=False

The line of code that fails is
.Refresh BackgroundQuery:=False

We have attempted to run this on Excel 97 and it failed, so we moved to an
Excel 2003 workstation and ran it, and much to my surprise, it too failed.
All I ended up with was a row of field names, but no data.

I am stumped. What do I have to change or activate to make this work?
Is there something that I can add to my code to be sure that whatever the
required element is, that it is activated so that the macro gets the
expected results?
Thanks in advance.
TTFN
JMMach


 
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
Problems with .Refresh BackgroundQuery:=False dmplacebo Excel Worksheet Functions 0 July 11th 05 12:39 PM
Error on refresh backgroundquery - help please RichardLOZ Excel Programming 7 February 6th 05 11:49 PM
Web query .Refresh BackgroundQuery:=False problem Jim[_55_] Excel Programming 1 January 26th 05 04:08 PM
Refresh BackgroundQuery problem when migrating to Excel XP Doron Hadar Excel Programming 1 November 4th 04 10:10 PM
Excel does not close from VB!! (when i refresh Refresh query with BackgroundQuery:=False) Anant[_2_] Excel Programming 1 August 6th 03 04:22 AM


All times are GMT +1. The time now is 08:55 AM.

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

About Us

"It's about Microsoft Excel"