Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Turn ON design mode...

Thanks a lot all for your participation in my issue.



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
how do I turn on/off "Design mode" in Excel 2007 easybuild Excel Discussion (Misc queries) 2 April 3rd 23 11:10 AM
turn off design mode [email protected] Excel Programming 2 August 29th 06 01:06 PM
how to turn off design mode Paul Excel Worksheet Functions 2 September 23rd 05 01:10 PM
Hyperlinks Inserted in Design Mode inactive once Exited Design Mod Craig Excel Programming 0 March 16th 05 04:53 PM
Enter Excel Design Mode and Exit Design Mode Bill Lunney Excel Programming 0 August 4th 03 07:48 AM


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