ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Store the Spreadsheets filename in a variable? (https://www.excelbanter.com/excel-programming/325659-store-spreadsheets-filename-variable.html)

Mike Hanby

Store the Spreadsheets filename in a variable?
 
Hey all,

How can I get the filename of the spreadsheet and store that string in a
variable using vba? (just the filename, not the path)

Essentially, I'd like to be able to print out the filename of the
spreadsheet without having to hardcode the name.

Sort of like in bash, how you can refer to $0.

Thanks,

Mike

Mike Hanby

[Solved] Store the Spreadsheets filename in a variable?
 
Dim fileName As String
fileName = ActiveWorkbook.Name

Mike Hanby said the following on 03/17/2005 16:15:
Hey all,

How can I get the filename of the spreadsheet and store that string in a
variable using vba? (just the filename, not the path)

Essentially, I'd like to be able to print out the filename of the
spreadsheet without having to hardcode the name.

Sort of like in bash, how you can refer to $0.

Thanks,

Mike


Myrna Larson

Store the Spreadsheets filename in a variable?
 

Worksheets("Sheet1").Parent.Name



On Thu, 17 Mar 2005 16:15:51 -0600, Mike Hanby
wrote:

Hey all,

How can I get the filename of the spreadsheet and store that string in a
variable using vba? (just the filename, not the path)

Essentially, I'd like to be able to print out the filename of the
spreadsheet without having to hardcode the name.

Sort of like in bash, how you can refer to $0.

Thanks,

Mike




All times are GMT +1. The time now is 03:00 PM.

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