Results 1 to 8 of 8

Thread: ToggleButton for Smart Quotes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Banned VBAX Newbie
    Joined
    Feb 2025
    Posts
    1
    Location
    To add a toggle button for Smart Quotes in Word, you'll need to use RibbonX with a bit of VBA to change the settings. Here’s a simple outline of what you can do:

    1. In RibbonX, add a toggle button to your ribbon:

    xml

    HTML Code:
    <ribbon>
      <tabs>
        <tab id="customTab" label="Custom Tab">
          <group id="customGroup" label="Smart Quotes">
            <toggleButton id="toggleSmartQuotes" label="Smart Quotes" onAction="ToggleSmartQuotes" />
          </group>
        </tab>
      </tabs>
    </ribbon>
    1. Then, in your VBA code, write a subroutine to toggle the setting:



    Sub ToggleSmartQuotes(control As IRibbonControl)
        Dim currentSetting As Boolean
        currentSetting = Application.Options.UseSmartQuotes
        ' Toggle the smart quotes setting
        Application.Options.UseSmartQuotes = Not currentSetting
        ' Update the toggle button to reflect the new state
        If Application.Options.UseSmartQuotes Then
            control.Label = "Smart Quotes: On"
        Else
            control.Label = "Smart Quotes: Off"
        End If
    End Sub
    1. To indicate whether Smart Quotes are on or off, you'll need to dynamically update the label or the button icon depending on the state. The code checks the current setting and updates the button accordingly.

    This should give you a working toggle button for Smart Quotes. You can also adjust the logic to better fit your needs.
    Last edited by Aussiebear; 02-17-2025 at 08:21 PM. Reason: Removed the spam links

Posting Permissions

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