ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook file name (https://www.excelbanter.com/excel-programming/421028-workbook-file-name.html)

Fan924

Workbook file name
 
Workbook file name. How do I call it up for use in a macro?

Jarek Kujawa[_2_]

Workbook file name
 
ActiveWorkbook.Name

Fan924

Workbook file name
 
Thanks.

Chip Pearson

Workbook file name
 

If you want just the file name with no path information, use

ActiveWorkbook.Name
' or
ThisWorkbook.Name

If you want the full file name including path information, use

ActiveWorkbook.FullName
' or
ThisWorkbook.FullName

ActiveWorkbook refers to the workbook that is active in Excel,
regardless of which workbook contains the code. ThisWorkbook always
refers to the workbook that contains the code, regardless of what
workbook might be active in Excel.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 9 Dec 2008 05:33:13 -0800 (PST), Fan924
wrote:

Workbook file name. How do I call it up for use in a macro?


Fan924

Workbook file name
 
Nice. Thanks for the details on ActiveWorkbook & ThisWorkbook

Brenner

Workbook file name
 

I hope you don't mind me 'piggy-backing' on your question Fan924, but I'm
looking for the file name, but it's nither the ActiveWorkbook nor
ThisWorkbook. I'm trying to avoid opening each workbook to get verification
inside the file, because the open/close happening across the network takes
too long...

Can you all expand a little more on this?

Thanks!
John


"Chip Pearson" wrote:

If you want just the file name with no path information, use

ActiveWorkbook.Name
' or
ThisWorkbook.Name

If you want the full file name including path information, use

ActiveWorkbook.FullName
' or
ThisWorkbook.FullName

ActiveWorkbook refers to the workbook that is active in Excel,
regardless of which workbook contains the code. ThisWorkbook always
refers to the workbook that contains the code, regardless of what
workbook might be active in Excel.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 9 Dec 2008 05:33:13 -0800 (PST), Fan924
wrote:

Workbook file name. How do I call it up for use in a macro?



Fan924

Workbook file name
 
Not sure what you are asking.

Brenner

Workbook file name
 
I have a post from this morning that explains it a little better. Haven't
gotten it to work yet... :o(

Post: fname = Dir() returns and 'invalid procedure call or argument'
12/10/08

Have a good one...
John


"Fan924" wrote:

Not sure what you are asking.



All times are GMT +1. The time now is 08:12 PM.

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