Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Enabling sub menu items via vba | Excel Worksheet Functions | |||
Enabling shortcut menu | Excel Discussion (Misc queries) | |||
Menu items added with menu item editor in older versions | Excel Discussion (Misc queries) | |||
Disable File-Save menu item in macro? | Excel Programming | |||
Macro to display a menu item - possible? | Excel Programming |