![]() |
returning filename in excel
In MS Word I used:
With Dialogs(wdDialogFileOpen) If .Display Then strSourceFile = WordBasic.FilenameInfo$(.Name, 1) End If End With to obtain the filename of the active document. How can I do this in Excel? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
returning filename in excel
Claud
To get the filename of the activeworkbook, use sFileName=ActiveWorkbook.FullName If you want to display the open dialog and then open a workbook sFilename=Application.GetOpenFileName() Workbooks.Open FileName:=sFileName -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS "Claud Balls" wrote in message ... In MS Word I used: With Dialogs(wdDialogFileOpen) If .Display Then strSourceFile = WordBasic.FilenameInfo$(.Name, 1) End If End With to obtain the filename of the active document. How can I do this in Excel? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
returning filename in excel
ActiveWorkbook.Name
or ActiveWorkbook.FullName -- Regards Juan Pablo González "Claud Balls" wrote in message ... In MS Word I used: With Dialogs(wdDialogFileOpen) If .Display Then strSourceFile = WordBasic.FilenameInfo$(.Name, 1) End If End With to obtain the filename of the active document. How can I do this in Excel? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
returning filename in excel
Claud,
Check out the GetOpenFilename method in VBA help. -- HTH RP (remove nothere from the email address if mailing direct) "Claud Balls" wrote in message ... In MS Word I used: With Dialogs(wdDialogFileOpen) If .Display Then strSourceFile = WordBasic.FilenameInfo$(.Name, 1) End If End With to obtain the filename of the active document. How can I do this in Excel? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
returning filename in excel
One way:
strSourceFile = ActiveWorkbook.Name or, if you want the path, too strSourceFile = ActiveWorkbook.FullName In article , Claud Balls wrote: In MS Word I used: With Dialogs(wdDialogFileOpen) If .Display Then strSourceFile = WordBasic.FilenameInfo$(.Name, 1) End If End With to obtain the filename of the active document. How can I do this in Excel? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 02:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com