View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Skipping Import Text File dialog in a Macro

I'm not usre, but I think it is because you are using Fix Width data. I
don't get the pop up when I'm using Delimited Data. try re-recording a macro
and use a Delimiter rather than fixed width. If you need fixed width data
then I have a macro that opens a text file and export the cells one at a time.

"Leon" wrote:

I tried the following but the dialog always appears and forces me to click
the Import button.

Sheets("Sheet1").Select
Application.DisplayAlerts = False
With Selection.QueryTable
.Connection = _
"TEXT;C:\Edrive\standalone\Lineup\18ScorecardRoste r.txt"
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(2, 2)
.TextFileFixedColumnWidths = Array(4)
.Refresh BackgroundQuery:=False
End With
Sheets("Scorecard-v").Select