ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Object Button (https://www.excelbanter.com/excel-programming/403798-select-object-button.html)

pan65

Select Object Button
 
I am using Excel 2000. Near the bottom left corner is the Select Object
button with the arrow cursor icon. Can this button be toggled on and off
using VBA code? If so, how? Thanks.

Rick Rothstein \(MVP - VB\)

Select Object Button
 
I think this will work (I don't have XL2000, but it works in my copy of
XL2003)...

Sub ToggleSelectObject()
Dim ctl As Object
For Each ctl In CommandBars("Drawing").Controls
If ctl.ID = 182 Then
ctl.Visible = Not ctl.Visible
End If
Next ctl
End Sub

Rick


"pan65" wrote in message
...
I am using Excel 2000. Near the bottom left corner is the Select Object
button with the arrow cursor icon. Can this button be toggled on and off
using VBA code? If so, how? Thanks.



Peter T

Select Object Button
 
If you mean toggle up/down simply

CommandBars.FindControl(ID:=182).Execute

or with a bit more control

Sub Toggle182(nState As Long)
Dim ctr As CommandBarButton
Set ctr = Application.CommandBars.FindControl(ID:=182)
If ctr.State < nState Then
ctr.Execute
End If
End Sub

Sub test()
Toggle182 msoButtonDown ' -1
Stop
Toggle182 msoButtonUp ' 0

End Sub


Regards,
Peter T


"pan65" wrote in message
...
I am using Excel 2000. Near the bottom left corner is the Select Object
button with the arrow cursor icon. Can this button be toggled on and off
using VBA code? If so, how? Thanks.




Rick Rothstein \(MVP - VB\)

Select Object Button
 
I read the "toggle on and off" part of your question as asking to make the
button visible or invisible. I see Peter T read your question differently.
You might have to clarify for us exactly what you are looking for.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
I think this will work (I don't have XL2000, but it works in my copy of
XL2003)...

Sub ToggleSelectObject()
Dim ctl As Object
For Each ctl In CommandBars("Drawing").Controls
If ctl.ID = 182 Then
ctl.Visible = Not ctl.Visible
End If
Next ctl
End Sub

Rick


"pan65" wrote in message
...
I am using Excel 2000. Near the bottom left corner is the Select Object
button with the arrow cursor icon. Can this button be toggled on and off
using VBA code? If so, how? Thanks.




pan65

Select Object Button
 
Thanks that was exactly what I was looking for.

"Peter T" wrote:

If you mean toggle up/down simply

CommandBars.FindControl(ID:=182).Execute

or with a bit more control

Sub Toggle182(nState As Long)
Dim ctr As CommandBarButton
Set ctr = Application.CommandBars.FindControl(ID:=182)
If ctr.State < nState Then
ctr.Execute
End If
End Sub

Sub test()
Toggle182 msoButtonDown ' -1
Stop
Toggle182 msoButtonUp ' 0

End Sub


Regards,
Peter T


"pan65" wrote in message
...
I am using Excel 2000. Near the bottom left corner is the Select Object
button with the arrow cursor icon. Can this button be toggled on and off
using VBA code? If so, how? Thanks.






All times are GMT +1. The time now is 07:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com