Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Aug 2015
    Posts
    98
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Adding bold quote marks in word 2010

    Hi, I am trying to update the coding below to ensure the first quote mark is bold - currently when I highlight bold words to insert quote marks, e.g. Acquisition Agreement to "Acquisition Agreement", currently the macro does this "Acquisition Agreement". Is there a way to get the macro to convert the first set of quotes to bold. Many thanks, Shelley

    Code:
    Sub AddQuotes()
        Dim sBegQ As String
        Dim sEndQ As String
    
        If Options.AutoFormatAsYouTypeReplaceQuotes Then
            sBegQ = Chr(147)
            sEndQ = Chr(148)
        Else
            sBegQ = Chr(34)
            sEndQ = Chr(34)
        End If
    
        Selection.InsertBefore sBegQ
        Selection.InsertAfter sEndQ
    End Sub

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    L.L.,

    This seems to do the trick.
    Code:
    Option Explicit
    
    Sub AddQuotes()
        Dim sBegQ As String
        Dim sEndQ As String
    
        If Options.AutoFormatAsYouTypeReplaceQuotes Then
            sBegQ = Chr(147)
            sEndQ = Chr(148)
        Else
            sBegQ = Chr(34)
            sEndQ = Chr(34)
        End If
    
        With Selection
            .InsertBefore sBegQ
            .InsertAfter sEndQ
            .BoldRun
        End With 'Selection
        
    End Sub
    Test results:
    Bold.PNG

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Star Lounger
    Join Date
    Aug 2015
    Posts
    98
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Many thanks RG, the macro works perfectly now, regards Shelley

Posting Permissions

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