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: 1,388
Default user to select path

Hi,
I'm using Excel 2003
I want to automate the importing of data from a .txt file, but the .txt file
won't always be in the same place.
When I do it manually, (with the macro recorder on), I use:
Data Import External Data Import Data
The 'Select Data Source' dialogue box appears, I find the file I want, hit
OK, then the 'Text Import Wizard' box comes up, etc.
Problem is, the macro records that specific path.
What I would like the macro to do is to ask the user to find the file, then
automatically do the Text Import Wizard stuff.
Is this possible?
Here is the code so far.

Range("AA1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\User 4\Desktop\New Quote Sheet\Pick
Place for JRB001078B DDU.txt" _
, Destination:=Range("AA1"))
.Name = "Pick Place for JRB001078B DDU"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub

Regards - Dave.
 
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
Embed PDF and select file name and path Jenny B. Excel Discussion (Misc queries) 2 June 5th 09 12:19 PM
Select folder path Ludo Excel Programming 7 September 4th 08 11:50 AM
Prompt user to select a printer using a checkbox within a user Tom Ogilvy Excel Programming 0 January 10th 07 03:57 AM
Needing to select file path with Set command [email protected] Excel Programming 5 December 20th 05 09:48 PM
path user defined chart jacob[_5_] Excel Programming 1 October 26th 03 01:15 AM


All times are GMT +1. The time now is 08:12 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"