Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 190
Default Macros and Menu Command

I recorded a simple macro and saved it only in a specific workbook. I placed
a menu command on that toolbar.

Now every workbook I open has the menu command in it and when I click the
menu command that appears in a workbook where it shouldn't, it automatically
opens up the worksheet that the macro was originally designed for.

How can I save the recorded macro and menu command only in one workbook and
be sure that it doesn't appear anywhere else?
  #2   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Macros and Menu Command

record a macro to add and one to delete the menu item
in the workbook you want it on put the install in on startup and the delete
on close

"mary" wrote:

I recorded a simple macro and saved it only in a specific workbook. I placed
a menu command on that toolbar.

Now every workbook I open has the menu command in it and when I click the
menu command that appears in a workbook where it shouldn't, it automatically
opens up the worksheet that the macro was originally designed for.

How can I save the recorded macro and menu command only in one workbook and
be sure that it doesn't appear anywhere else?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 190
Default Macros and Menu Command

I also found something else on the web that may be a help:

Custom menu items are going to be available to all Workbooks and Worksheets.
This can be an issue when the macro is intended for a specific Worksheet in a
specific Workbook. All you need to know to overcome this problem is the name
of the Toolbar you have placed your custom menu item on. The Worksheet Menu
Bar is a safe bet.

Activate the sheet that your macro needs active to run correctly.
Right click on the sheet name tab and select View Code and place in the code
as shown below:
Private Sub Worksheet_Activate()
Application.CommandBars("Worksheet Menu Bar").Controls _
("My Macro").Enabled = True
End Sub

Private Sub Worksheet_Deactivate()
Application.CommandBars("Worksheet Menu Bar").Controls _
("My Macro").Enabled = False
End Sub


Simply change the name of My Macro to the name of your menu item.


"bj" wrote:

record a macro to add and one to delete the menu item
in the workbook you want it on put the install in on startup and the delete
on close

"mary" wrote:

I recorded a simple macro and saved it only in a specific workbook. I placed
a menu command on that toolbar.

Now every workbook I open has the menu command in it and when I click the
menu command that appears in a workbook where it shouldn't, it automatically
opens up the worksheet that the macro was originally designed for.

How can I save the recorded macro and menu command only in one workbook and
be sure that it doesn't appear anywhere else?

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
Replace menu command not working RS Excel Discussion (Misc queries) 2 January 29th 07 05:57 PM
How disable menu command Armangelo Excel Discussion (Misc queries) 0 February 1st 06 10:00 AM
Name command in Insert Menu Ahmad Wali Zahid Excel Discussion (Misc queries) 1 January 31st 06 08:37 AM
Create an "on my computer" menu command Meg_07 Setting up and Configuration of Excel 0 July 12th 05 01:53 AM
there is no XML command on my data menu Mattie Excel Worksheet Functions 1 November 27th 04 09:00 AM


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