J
Josh Sale
I have an Excel 97-2003 add-in that includes a toolbar that includes a copy
of Excel's Design Mode toolbar button (View | Toolbars | Control Toolbox).
My users click this button to put the worksheet into design mode so they can
change the layout of controls (command buttons, etc) programatically placed
onto the worksheet.
Another button on this toolbar allows them to save their updated worksheet
design. If they click this button while they are still in design mode, then
when my VBA code gets around to performing:
thisWorkbook.ActiveSheet.Copy after:=thatWorkbook.Worksheets(1)
it gets "Application-defined or object-defined error" error message.
The way I've implemented the design mode, my code never sees the user's
button click that puts them into (or out of) design mode. So I currently
have no way to "remember" that I'm currently in design mode and get myself
out before trying to save the redesigned worksheet (of course that assumes I
know how to programatically get our of design mode and I don't).
So a few questions:
- Is there a way for my code to detect that the workbook (or is it the
project?) is still in design mode? If so how?
- If there is, is there some way for my code to get out of design mode?
- Is there some other way of having a toolbar button toggle in and out of
design mode where my code is in the execution loop rather than just copying
Excel's Design Mode toolbar button onto my toolbar?
TIA,
josh
of Excel's Design Mode toolbar button (View | Toolbars | Control Toolbox).
My users click this button to put the worksheet into design mode so they can
change the layout of controls (command buttons, etc) programatically placed
onto the worksheet.
Another button on this toolbar allows them to save their updated worksheet
design. If they click this button while they are still in design mode, then
when my VBA code gets around to performing:
thisWorkbook.ActiveSheet.Copy after:=thatWorkbook.Worksheets(1)
it gets "Application-defined or object-defined error" error message.
The way I've implemented the design mode, my code never sees the user's
button click that puts them into (or out of) design mode. So I currently
have no way to "remember" that I'm currently in design mode and get myself
out before trying to save the redesigned worksheet (of course that assumes I
know how to programatically get our of design mode and I don't).
So a few questions:
- Is there a way for my code to detect that the workbook (or is it the
project?) is still in design mode? If so how?
- If there is, is there some way for my code to get out of design mode?
- Is there some other way of having a toolbar button toggle in and out of
design mode where my code is in the execution loop rather than just copying
Excel's Design Mode toolbar button onto my toolbar?
TIA,
josh