LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default re-enabling macro under menu item

That's one of the pitfalls of screwing with the menus!

I think most would approach it by having the code disable the "print..." option
when that workbook was opened. Then re-enable it when you close the workbook.

You could use your code in the auto_0pen and auto_close procedures in a general
module (or workbook_open and workbook_beforeclose under ThisWorkbook).

But if you want to be nice to your users who have multiple workbooks open, you'd
have to enable the Print option when they changed workbooks. And then disable
it when they came back to yours.

And if excel crashed, it would be nice if you gave them a routine that fixed the
toolbar the way it was before you disabled items.

I know I don't like other workbooks screwing around the stuff I use. Maybe
living with a few wasted sheets of paper (until they learn) would be worth it.

(and don't forget ctrl-P, and print preview, the print icon itself and the
shiftPrintPreview icon all offer other ways to print.)

And if the user disables macros ....

In my opinion, it's just too much effort for the perceived benefit.



jerry h wrote:

A few posts here provide me added knowledge. In one, it mentioned a way to disable "Print option under File", using

CommandBars("Worksheet Menu Bar").Controls("File").Controls("Print...").Enable d = False

Suppose I open a new Excel file. Fire up macro editor and make up one macro with the following variant:
sub disableM()
CommandBars("Worksheet Menu Bar").Controls("File").Controls("Print...").Enable d = False
end sub

I save the Excel file as test.xls. Run the macro. It "works". The macro option has gone. But then how can I get my macro option back? I thought my 'macro option' will be back if I close Excel and reopen Excel. But no, the option doesn't come back. What is the simplest solution (to give the macro function back to the user) IF this was the case?

I am a little bit smarter than the dummies. I do not actually have such a problem because I "forsee" it. I did wrote an enableM() function together with my disableM() function under "test.xls". So what I did to resolve the problem is to enter the keyboard shortcut for enableM(). But IN CASE there wasn't such command, is there a simpler solution to reset the macro function back to life, without borrowing another pc to create an excel file with enableM() macro?


--

Dave Peterson

 
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
Enabling sub menu items via vba Dan Neely Excel Worksheet Functions 0 July 11th 05 04:48 PM
Enabling shortcut menu Slypaw Excel Discussion (Misc queries) 3 March 16th 05 12:37 AM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
Disable File-Save menu item in macro? BrianG[_4_] Excel Programming 1 February 25th 04 06:48 PM
Macro to display a menu item - possible? TonyJeffs Excel Programming 3 November 16th 03 08:38 AM


All times are GMT +1. The time now is 04:01 AM.

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

About Us

"It's about Microsoft Excel"