• Toolbar Buttons Toggle (W97)

    Author
    Topic
    #378454

    I have a button that will check to verify that a set of styles are not assigned to the text and then assigns the Style Bold (macro: AssignStyleBold).
    If RetiredRequirementCheck() = False Then
    Selection.Style = ActiveDocument.Styles(“bold”)

    How do I get the button to toggle? The best I’ve been able to do is create a separate button that returns the normal font. – Jody

    Viewing 0 reply threads
    Author
    Replies
    • #626560

      Jody,

      At risk of sounding like a broken record, more information is required here too. It is possible to toggle the appearance or text of toolbar buttons – but it’s unclear whether you are trying to toggle the appearance of the button, or simply have its action act like a toggle. If the latter, does something like:

      If RetiredRequirementCheck() = False Then
      Selection.Style = ActiveDocument.Styles(“bold”)
      Else
      Selection.Style = ActiveDocument.Styles(“Normal”)
      End If

      do what you need?

      Gary

      • #626588

        I was going for the Visual toggle…. like the Bold button on the MSO formatting toolbar. When something is marked bold it appears depressed and when you click it again it lifts and the font returns to normal…. so I guess it’s a combination of both.

        • #626601

          Try looking at the ‘msoButtonState’ constants such as msoButtonUp and msoButtonDown.

          Gary

          • #626607

            If you change the state of a toolbar button to Up or Down then it will remain in that state until you change it again.

            This is fine if the button represents some application wide status.
            If the button state represents something about the document then you will need to modify it in a DocumentChange event.
            If the button represents something about the current selection or paragraph then I have never found a good way to keep it updated.

            StuartR

    Viewing 0 reply threads
    Reply To: Toolbar Buttons Toggle (W97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: