Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User defined file name in an OpenText File command

using the OpenText File command, is there a way for the user using th
macro define the path & file name rather then it defaulting to the fil
defined in the code.

Here is the original code: Right now I have to have the user befor
using the Excel file to define their data in this data.txt file. Whic
is an extra step that if at all possible needs to be stream lined.

Workbooks.OpenText FileName:="C:\Cutsheets\data.txt"
Origin:=xlWindows, _StartRow:=1, DataType:=xlFixedWidth
FieldInfo:=Array(0, 1)

I appreciate any help in this.
Thanks,
Chri

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default User defined file name in an OpenText File command

You could use INputBox to ask the user for input, or even use the
GetOpenFileName method to allo0w the user to browse folders for a file. The
latter just returns the file name, it doesn't open it.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"surveyorinva " wrote in
message ...
using the OpenText File command, is there a way for the user using the
macro define the path & file name rather then it defaulting to the file
defined in the code.

Here is the original code: Right now I have to have the user before
using the Excel file to define their data in this data.txt file. Which
is an extra step that if at all possible needs to be stream lined.

Workbooks.OpenText FileName:="C:\Cutsheets\data.txt",
Origin:=xlWindows, _StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(0, 1)

I appreciate any help in this.
Thanks,
Chris


---
Message posted from http://www.ExcelForum.com/



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
User defined file name on save Jim G Excel Discussion (Misc queries) 11 October 30th 06 01:29 AM
Attaching Help File to a User Defined Function maca Excel Discussion (Misc queries) 0 July 5th 05 02:32 PM
can i save an existing .xls file as a .csv file using command line craigkan Excel Discussion (Misc queries) 2 February 18th 05 02:01 PM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:22 PM
Using Workbooks.OpenText to read a tab-delimited file into a worksheet Dan E[_2_] Excel Programming 0 August 19th 03 08:02 PM


All times are GMT +1. The time now is 02:51 PM.

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"