ERLANDSEN DATA CONSULTING Excel & VBA Tips   Informasjon på norsk / Information in Norwegian

These pages are no longer updated and are only available for archive purposes.

Click here to visit the pages with updated information.

Change the state of a custom CommandBar button

The macro below shows how you can change the state of a custom CommandBar button so it displays as depressed or not.

Sub ToggleButtonState()
Dim m As CommandBarControl
    Set m = CommandBars("CommandBarName").Controls(1)
    If m.State = msoButtonDown Then
        m.State = msoButtonUp
    Else
        m.State = msoButtonDown
    End If
    Set m = Nothing
End Sub

 

Document last updated 2000-02-05 12:47:00      Printerfriendly version

 

Erlandsen Data Consulting     http://www.erlandsendata.no/   
Excel & VBA Tips   Copyright ©1999-2024    Ole P. Erlandsen   All rights reserved
E-mail Contact Address