Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default [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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving data from Excel and store it into string variable marsulein[_5_] Excel Programming 1 November 10th 04 01:43 AM
Retrieving data from Excel and store it into string variable marsulein[_4_] Excel Programming 1 November 9th 04 09:35 AM
Retrieving data from Excel and store it into string variable marsulein[_3_] Excel Programming 1 November 9th 04 04:47 AM
Retrieving data from Excel and store it into string variable marsulein[_2_] Excel Programming 1 November 9th 04 02:04 AM
Store variable value for Chart Al Jager Excel Programming 1 February 19th 04 10:58 AM


All times are GMT +1. The time now is 11:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"