Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Workbook Reference for Macros

How can I control the workbook reference when I assign a
macro to a toolbar button?

I want the workbook reference to always be the current
workbook.

TIA,
Rich
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Workbook Reference for Macros

I'm sure the gurus can explain this in more detail, but basically ThisWorkbook
refers to the workbook the macro is stored in, and ActiveWorkbook refers to
the - yes - active workbook.

Enter the following macro in a code module:

'----
Public Sub WorkbookNames()
MsgBox "This = " & ThisWorkbook.Name & " Active = " & ActiveWorkbook.Name
End Sub
'----

HTH
Anders Silvén

"Rich" skrev i meddelandet
...
How can I control the workbook reference when I assign a
macro to a toolbar button?

I want the workbook reference to always be the current
workbook.

TIA,
Rich



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
Changing Column Reference in Macros? JDM Excel Discussion (Misc queries) 2 October 28th 09 05:17 PM
Appropriate use of cell reference when creating macros L'il Ginny Excel Discussion (Misc queries) 3 September 12th 08 03:17 PM
Relative Reference Help Macros PhillipsHQ Excel Worksheet Functions 5 August 18th 06 03:29 PM
how do the macros get data from te reference tables? Kitchen Tune Up - Mario Excel Discussion (Misc queries) 3 January 20th 06 12:12 AM
How do I save a workbook as a new workbook by using macros? KingKarl Excel Discussion (Misc queries) 4 November 10th 05 08:34 AM


All times are GMT +1. The time now is 11:34 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"