Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro to show opening file dialog box

Status
Not open for further replies.

pendle666

Technical User
Jan 30, 2003
295
GB
Hello

I want my macro to show a list of files in a certain folder using the open file dialog box. This is what I have so far:

'
ChDir _
"J:\Payroll\Holiday Journal\"
Workbooks.Open Filename:= _
"J:\Payroll\Holiday Journal\"

obviously the

workbooks.open filename:=

but I want it to stop at this point to allow the user to select the file that they want. As it is it's giving me an error message.

Can someone point me in the right direction?

regards

Pendle
 
Thanks but that wasn't referring to Visual Basic which I needed.

Thanks Anyway
 
Try:

Code:
Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFilePicker)
f.Show
MsgBox "file chosen is: " & f.SelectedItems(1)

Have fun.

---- Andy
 
Check out application.GetOpenFileName method

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks for the suggestions, I'll try them on Monday when I'm back at work


regards

Pendle
 
Thanks but that wasn't referring to Visual Basic which I needed.

Yes it does refer to VB, scroll down.

Never knock on Death's door: ring the bell and run away! Death really hates that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top