switch on 'snap to' from vba

J

jngi

Does anyone out there know how to switch on the 'snap to grid' - drawing tools - using VBA? When I record a macro no code appears for this. I've tried 'msoSnapToGrid' etc etc.
 
T

Tom Ogilvy

Sub Macro4()
Dim btn As CommandBarButton
Set btn = CommandBars("Drawing").FindControl(ID:=549, Recursive:=True)
btn.Execute
End Sub

--
Regards,
Tom Ogilvy

jngi said:
Does anyone out there know how to switch on the 'snap to grid' - drawing
tools - using VBA? When I record a macro no code appears for this. I've
tried 'msoSnapToGrid' etc etc.
 
T

Tom Lavedas

I knew it was done through the CommandBars object, but it's so far down in the menu tree that it took some digging to find ...

Set cb = CommandBars("Drawing").Controls(1).CommandBar.Controls(5)_
.CommandBar.Controls(1)
if Not (cb.State = msoButtonDown) Then cb.Execute

Tom Lavedas
===========
 
T

Tom Lavedas

I knew it was done through the CommandBars object, but it's so far down in the menu tree that it took some digging to find ...

Set cb = CommandBars("Drawing").Controls(1).CommandBar.Controls(5)_
.CommandBar.Controls(1)
if Not (cb.State = msoButtonDown) Then cb.Execute

Tom Lavedas
===========
 
Top