Toggle Selection Mode

G

Guest

I am not sure how to ask this but here goes...

In the Drawing Toolbar there is an icon that looks like a white arrow that
allows you to toggle between a "hand" icon or a "NWSE" icon when the cursor
is over a button, can anyone tell me what is the code that allows for the
toggle to switch back and forth? I hope this makes sense.

Thanks!
 
G

Guest

Hi borg,

If you mean the arrow that switches you into "box-select" mode, it's not a
'toggle' in the sense of the true meaning of toggle. It basically does the
same thing as the Design Mode button in that it turns "box-select" mode on or
off.

When we refer to toggling, we mean we are reverting a setting. For example,
to "toggle" the visibility of a toolbar, the code would be:

Commandbars("whatever").Visible = Not Commandbars("whatever").Visible

so that if it's visible, it becomes not visible; ..and vice versa.

HTH
Regards,
GS
 
G

Guest

Hi Borg,

Application.CommandBars("Drawing").Controls("Select Objects").Execute

The above line would programatically click the button for you. Be aware
that it would throw an error if the Select Objects button were not present on
the Drawing toolbar. The following routine would restore the button if it
wasn't there, and then click it.

Sub ToggleSelectObjects()
Dim CBC As CommandBarControl
On Error GoTo RestoreSelectObjectsButton
Set CBC = Application.CommandBars("Drawing").Controls("Select Objects")
CBC.Execute
Exit Sub
RestoreSelectObjectsButton:
Set CBC = Application.CommandBars("Drawing").Controls.Add _
(Type:=msoControlButton, ID:=182, Before:=2)
Resume Next
End Sub



Regards,
Vic Eldridge
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top