View Single Post
 
Old 09-05-2019, 03:08 PM
jeffreybrown jeffreybrown is offline Windows 10 Office 2016
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Hi Paul,

Okay I've found something to start with, but can't figure out how to more one past the em dash.

Again, I'm going to start with something simple and then try to move on to the bigger task. This code below will allow me to bold the first part of this paragraph all that which is before the em dash.

I have one line in my document for starters.

ADPE—AUTOMATED DATA PROCESSING EQUIPMENT

Running the macro below the .start is 5 and then the .end equals 4 so the paragraph collapses to the first 4 characters and bolds.

Not sure how to get the start to be 6 and then proceed to the end and collapse?

Code:
Sub Bold_Terms2()
    With Selection.Range
      With .Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = "^+"
        .Replacement.Text = ""
        .Forward = True
        .Format = False
        .MatchWildcards = False
        .Wrap = wdFindStop
        .Execute
      End With
      Do While .Find.Found
      If .Find.Found = True Then
        With .Duplicate
          .Start = .Paragraphs.First.Range.Start
          .End = .End - 1
          .Font.Bold = True
        End With
        .Collapse wdCollapseEnd
        .Find.Execute
      End If
        Loop
    End With
End Sub
Reply With Quote