Using cmdlg xlDialogOpen

P

PO

My code needs to know the path and filename to a workbook for later use. The
info is to be provided by the user.

I tried to use:

Application.Dialogs(xlDialogOpen).Show

but that only returns the value true or false.

I still want the dialog to show but instead of true or false I want the
dialog to return the path and filename to the workbook. Also I don't want
the file to open - I just need the path info.

Any ideas?

TIA
PO
 
T

Tom Ogilvy

fname = Application.GetOpenFileName()
see help for options. This returns the users selection, but does not open
the file. You would use the information returned with

workbooks.Open fname
as an example it you want the file opened.

Also look at application.GetSaveAsFileName for similar funcitonality with
the saveas dialog.
 
P

PO

Works just like I intended.

Thanks!!
PO


Tom Ogilvy said:
fname = Application.GetOpenFileName()
see help for options. This returns the users selection, but does not open
the file. You would use the information returned with

workbooks.Open fname
as an example it you want the file opened.

Also look at application.GetSaveAsFileName for similar funcitonality with
the saveas dialog.
 

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