Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Feb 2002
    Thanked 0 Times in 0 Posts

    Add active buttons to menubar

    I want to insert four buttons on my menubar which indicate whether I'm printing double sided, double sided toner reductive, single sided, single sided toner reductive.
    That is not the problem, my problem is that I want to have an indication when the button is selected - just like the buttons for Bold, Italic etc.
    Is this possible at all?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Add active buttons to menubar

    You can do this in code.

    To give you an idea, here is an example of a simple macro. It is assigned to a toolbar button named "Test" on a toolbar named "myBar".

    Sub Test()
    Dim oBtn As CommandBarButton
    Set oBtn = CommandBars("myBar").Controls("Test")
    If Selection.Range.Bold = True Then
    oBtn.State = msoButtonUp
    Selection.Range.Bold = False
    oBtn.State = msoButtonDown
    Selection.Range.Bold = True
    End If
    End Sub

    For this to work, a reference to the Microsoft Office x.0 Object Library must be set (it usually is in Word VBA I believe; if not, select Tools/References in the Visual Basic editor, look for the Microsoft Office x.0 Object Library and make sure it's checked)

    For a real application, you need to do a lot of checking to ensure that the button is in the right state all the time.
    In your case, you'll need something to turn the button "off" when printing is finished.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts