View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
davemel davemel is offline
external usenet poster
 
Posts: 7
Default Macro to import delimeter file

I have created a macro to import a text file from our server (H: drive) but
whenever i run the macro it asks me to select the file from the Import Text
File window. I want to run the macro and for it to automatically load the
same text file into the spreadsheet every time without any user interaction.

The code created for my macro is shown below.

Range("A2").Select
With Selection.QueryTable
.Connection = "TEXT;H:\projects\quality database\qextract.txt"
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1)
.Refresh BackgroundQuery:=False

Any help greatly appreciated.

David