Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default returning workbook name

Hi

How do I return the name of my current workbook in code? Just the name ...
path not essential.

Thanks
Graeme


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default returning workbook name

MsgBox ActiveWorkbook.Name

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default returning workbook name

application.ActiveWorkbook.Name

"Saladin" wrote:

Hi

How do I return the name of my current workbook in code? Just the name ...
path not essential.

Thanks
Graeme



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default returning workbook name

msgbox ActiveWorkbook.Name
this returns the name of the currently active workbook

msgbox ThisWorkbook.Name
this returns the name of the workbook that is running the code

So if code is running in Book1 but book2 is active, then the first msgbox
gives Book2 and the second gives Book1

x=3
msgbox Workbooks(x).Name



DIM WB as Workbook
FOR EACH WB in Workbooks
Debug.Priint WB.Name
NEXT



"Saladin" wrote:

Hi

How do I return the name of my current workbook in code? Just the name ...
path not essential.

Thanks
Graeme



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default returning workbook name

Gosh that was quick! Thanks all.
"Patrick Molloy" wrote in message
...
msgbox ActiveWorkbook.Name
this returns the name of the currently active workbook

msgbox ThisWorkbook.Name
this returns the name of the workbook that is running the code

So if code is running in Book1 but book2 is active, then the first msgbox
gives Book2 and the second gives Book1

x=3
msgbox Workbooks(x).Name



DIM WB as Workbook
FOR EACH WB in Workbooks
Debug.Priint WB.Name
NEXT



"Saladin" wrote:

Hi

How do I return the name of my current workbook in code? Just the name
...
path not essential.

Thanks
Graeme





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
Returning info from another workbook Enyaw Excel Discussion (Misc queries) 1 February 17th 10 10:43 AM
Returning a text by searching the whole workbook Sai Krishna[_2_] Excel Discussion (Misc queries) 2 June 16th 08 06:08 AM
Links to another workbook returning 0 Graham Y Excel Discussion (Misc queries) 3 March 29th 07 09:19 PM
Returning to original workbook Jim Cone Excel Programming 0 July 23rd 04 11:03 AM
trouble returning a workbook level Name object Brian Murphy Excel Programming 32 May 12th 04 07:47 AM


All times are GMT +1. The time now is 09:30 PM.

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"