Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Turn ON design mode...
Hi,
When my macro runs I at some point wants to change into design mode - knowing that I properly can not get back to run mode with out a manual act. Anybody know the code to switch to design mode? Thanks, Flemming |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Turn ON design mode...
this worked in US English version:
Sub ABC() Application.CommandBars("Control Toolbox" _ ).Controls("&Design Mode").Execute End Sub You might need to identify the ID of the control and use FindControl to return a reference to it, then use the reference to execute it. -- Regards, Tom Ogilvy "Flemming" wrote: Hi, When my macro runs I at some point wants to change into design mode - knowing that I properly can not get back to run mode with out a manual act. Anybody know the code to switch to design mode? Thanks, Flemming |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Turn ON design mode...
Thanks Tom
"Tom Ogilvy" wrote in message ... this worked in US English version: Sub ABC() Application.CommandBars("Control Toolbox" _ ).Controls("&Design Mode").Execute End Sub You might need to identify the ID of the control and use FindControl to return a reference to it, then use the reference to execute it. -- Regards, Tom Ogilvy "Flemming" wrote: Hi, When my macro runs I at some point wants to change into design mode - knowing that I properly can not get back to run mode with out a manual act. Anybody know the code to switch to design mode? Thanks, Flemming |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Turn ON design mode...
Flemming,
Try code like the following: Sub EnterDesignMode() Application.CommandBars.FindControl(ID:=1605).Exec ute End Sub Sub ExitDesignMode() Dim Ctrl As CommandBarControl Set Ctrl = Application.CommandBars.FindControl(ID:=2597) If Ctrl.State < 0 Then Ctrl.Execute End If End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Flemming" wrote in message ... Hi, When my macro runs I at some point wants to change into design mode - knowing that I properly can not get back to run mode with out a manual act. Anybody know the code to switch to design mode? Thanks, Flemming |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Turn ON design mode...
Hey Chip
Thanks really helpful - had found the 1605 Execute Thanks, Flemming "Chip Pearson" wrote in message ... Flemming, Try code like the following: Sub EnterDesignMode() Application.CommandBars.FindControl(ID:=1605).Exec ute End Sub Sub ExitDesignMode() Dim Ctrl As CommandBarControl Set Ctrl = Application.CommandBars.FindControl(ID:=2597) If Ctrl.State < 0 Then Ctrl.Execute End If End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Flemming" wrote in message ... Hi, When my macro runs I at some point wants to change into design mode - knowing that I properly can not get back to run mode with out a manual act. Anybody know the code to switch to design mode? Thanks, Flemming |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Turn ON design mode...
Your ExitDesignMode module returns an error on If Ctrl.State < 0
Then -"Run-tiem error '91' - Object variable or with block variable not set. Could it be because of the new ribbon in Office 2007 which I use... Cheers, Flemming "Chip Pearson" wrote in message ... Flemming, Try code like the following: Sub EnterDesignMode() Application.CommandBars.FindControl(ID:=1605).Exec ute End Sub Sub ExitDesignMode() Dim Ctrl As CommandBarControl Set Ctrl = Application.CommandBars.FindControl(ID:=2597) If Ctrl.State < 0 Then Ctrl.Execute End If End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Flemming" wrote in message ... Hi, When my macro runs I at some point wants to change into design mode - knowing that I properly can not get back to run mode with out a manual act. Anybody know the code to switch to design mode? Thanks, Flemming |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Turn ON design mode...
I wrote and tested the code in Excel 2003. I'll see what's going on in 2007.
-- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Flemming" wrote in message ... Your ExitDesignMode module returns an error on If Ctrl.State < 0 Then -"Run-tiem error '91' - Object variable or with block variable not set. Could it be because of the new ribbon in Office 2007 which I use... Cheers, Flemming "Chip Pearson" wrote in message ... Flemming, Try code like the following: Sub EnterDesignMode() Application.CommandBars.FindControl(ID:=1605).Exec ute End Sub Sub ExitDesignMode() Dim Ctrl As CommandBarControl Set Ctrl = Application.CommandBars.FindControl(ID:=2597) If Ctrl.State < 0 Then Ctrl.Execute End If End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Flemming" wrote in message ... Hi, When my macro runs I at some point wants to change into design mode - knowing that I properly can not get back to run mode with out a manual act. Anybody know the code to switch to design mode? Thanks, Flemming |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Turn ON design mode...
I don't know about the situation in 2007 but in earlier versions I find it's
not always possible to set a reference to the Exit Design Mode control, depending on how and where (same or different project Design mode was entered) the code is run. Sometimes as soon as code starts design mode can automatically exit and the control no longer exists, akin to the changing 'existence' of the Insert button in different scenarios. I think even in earlier versions it might be worth checking 'Ctrl' returns a reference to the control. If it's Nothing, either the mere fact of running the code exited Design Mode or Design mode was not entered in the first place. Alternatively - If Application.CommandBars.FindControl(ID:=1605).Stat e Then Application.CommandBars.FindControl(ID:=2597).Exec ute End If plus a bit of error handling and/or attempt to first to set references to the controls and only proceed if they are not nothing. Regards, Peter T "Flemming" wrote in message ... Your ExitDesignMode module returns an error on If Ctrl.State < 0 Then -"Run-tiem error '91' - Object variable or with block variable not set. Could it be because of the new ribbon in Office 2007 which I use... Cheers, Flemming "Chip Pearson" wrote in message ... Flemming, Try code like the following: Sub EnterDesignMode() Application.CommandBars.FindControl(ID:=1605).Exec ute End Sub Sub ExitDesignMode() Dim Ctrl As CommandBarControl Set Ctrl = Application.CommandBars.FindControl(ID:=2597) If Ctrl.State < 0 Then Ctrl.Execute End If End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Flemming" wrote in message ... Hi, When my macro runs I at some point wants to change into design mode - knowing that I properly can not get back to run mode with out a manual act. Anybody know the code to switch to design mode? Thanks, Flemming |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Turn ON design mode...
Thanks a lot all for your participation in my issue.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do I turn on/off "Design mode" in Excel 2007 | Excel Discussion (Misc queries) | |||
turn off design mode | Excel Programming | |||
how to turn off design mode | Excel Worksheet Functions | |||
Hyperlinks Inserted in Design Mode inactive once Exited Design Mod | Excel Programming | |||
Enter Excel Design Mode and Exit Design Mode | Excel Programming |