Importing files

2

25jump

I got the marco:
Sub load_file()
'
' load_file Macro
In need to make a marco that loads different files on the excel
spreadsheet.
I got this marco to load a spefic file but I need one that will open a
select or clicked on file. any help would be great.


Workbooks.OpenText Filename:= _
"C:\Documents and Settings\rwhitfield\My Documents\Cap Test
Evaluation\JG02\Test Data\52551-001b_jg02 cap
retest_200507211316-0.dat" _
, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier
_
:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:= _
False, Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array
_
(1, 1), Array(2, 1), Array(3, 1))
End Sub
 
R

Robin Hammond

You might be looking for this:

Sub Test()
Dim vFile As Variant
vFile = Application.GetOpenFilename
Debug.print vFile
'put the rest of your code here using the vFile variable
End Sub

Robin Hammond
www.enhanceddatasystems.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top