Importing

andycrfc13

New member
Local time
Yesterday, 17:10
Joined
Aug 12, 2010
Messages
9
Hello,

I'm a beginner in using VBA and was wondering if anyone could help in assisting modifying some simple code. The code i have at the minute does the job that I intend it to do however it is on a predefined file.

Private Sub Command27_Click()

Dim FileName As String
Dim f As Integer
FileName = "C:\Documents and Settings\..."
f = FreeFile 'Get a file handle
Open FileName For Input As f 'Open the file
Me.Results = Input$(LOF(f), f) 'Read entire file into text box
Close f

End Sub

I would like to modify the code to ask the user to select the file they wish to use, however i am unsure what i need to change.

Thanks in advance
 
Last edited:
Check out the filedialog help.

Type in filedialo. Then, put the cursor back in and hit F1.
The path returned for filedialog.selecteditems(lbound(filedialog.selecteditems)) would be a string good for your filename variable.
 

Users who are viewing this thread

Back
Top Bottom