Change CommandBarButton state not working

D

Dale Fye

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:="FilePrintPreview")

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

End Sub
 

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