ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change CommandBarButton state not working (https://www.excelbanter.com/excel-programming/401731-change-commandbarbutton-state-not-working.html)

Dale Fye

Change CommandBarButton state not working
 

This was working yesterday, but now it is not. I have a custom popup menu
on a userform (this works great) that contains a PrintPreview button, that I
want to change the state from msoButtonUp to msoButtonDown, and reverse when
I click on the button. The following code was working, but now is not, any
ideas?

Public Sub FilePrintPreview()

Dim ctrl As CommandBarButton
Set ctrl = Application.CommandBars.FindControl(Tag:="FilePrin tPreview")

'Changes the buttons state from Down-Up or Up-Down
ctrl.State = IIf(ctrl.State = msoButtonDown, msoButtonUp, msoButtonDown)

End Sub

--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.


All times are GMT +1. The time now is 12:06 AM.

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