User defined file name in an OpenText File command

  • Thread starter Thread starter surveyorinva
  • Start date Start date
S

surveyorinva

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
 
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)
 
Back
Top