ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using cmdlg xlDialogOpen (https://www.excelbanter.com/excel-programming/388124-using-cmdlg-xldialogopen.html)

PO

Using cmdlg xlDialogOpen
 
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



Tom Ogilvy

Using cmdlg xlDialogOpen
 
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.

--
Regards,
Tom Ogilvy


"PO" wrote:

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




PO

Using cmdlg xlDialogOpen
 
Works just like I intended.

Thanks!!
PO


"Tom Ogilvy" skrev i meddelandet
...
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.

--
Regards,
Tom Ogilvy


"PO" wrote:

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







All times are GMT +1. The time now is 04:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com