View Single Post
 
Old 04-02-2018, 03:10 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,381
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

To combine them you could use:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim RngSel As Range, RngTmp As Range, i As Long, j As Long
With Selection
  Set RngSel = .Range
  With .Range
    With .Find
      .ClearFormatting
      .Replacement.Text = "\1"
      .Format = False
      .Forward = True
      .Wrap = wdFindContinue
      .MatchWildcards = True
      .Replacement.ClearFormatting
      .Text = "\[b\](*)\[/b\]"
      .Replacement.Font.Bold = True
      .Execute Replace:=wdReplaceAll
      .Replacement.ClearFormatting
      .Text = "\[i\](*)\[/i\]"
      .Replacement.Font.Italic = True
      .Execute Replace:=wdReplaceAll
      .Replacement.ClearFormatting
      .Text = "\[u\](*)\[/u\]"
      .Replacement.Font.Underline = True
      .Execute Replace:=wdReplaceAll
      .Replacement.ClearFormatting
      .Text = "\[color=0040FF\](*)\[/color\]"
      .Replacement.Font.ColorIndex = &HFF0400
      .Execute Replace:=wdReplaceAll
      .Wrap = wdFindStop
      .Text = "\[list=[0-9]\]*\[/list\]"
      .Replacement.ClearFormatting
      .Replacement.Text = ""
      .Execute
    End With
    Do While .Find.Found
      If .InRange(RngSel) = False Then Exit Do
      i = CLng(Split(Split(.Text, "]")(0), "=")(1)) - 1
      j = 0
      Set RngTmp = .Duplicate
      With .Duplicate
        .Paragraphs.First.Range.Text = vbNullString
        .Paragraphs.Last.Range.Text = vbNullString
        With .Find
          .ClearFormatting
          .Replacement.ClearFormatting
          .Text = "\[\*\]"
          .Replacement.Text = ""
          .Forward = True
          .Wrap = wdFindStop
          .Format = False
          .MatchWildcards = True
          .Execute
        End With
        Do While .Find.Found
          j = j + 1
          If .InRange(RngTmp) = False Then Exit Do
          .Text = i + j & ". "
          .Collapse wdCollapseEnd
          .Find.Execute
        Loop
      End With
      .Collapse wdCollapseEnd
      .Find.Execute
    Loop
  End With
End With
RngSel.Select
Set RngSel = Nothing: Set RngTmp = Nothing
Application.ScreenUpdating = True
End Sub
As for the size, you wouldn't use the &H prefix - you'd simply use whatever the appropriate number is. I have no idea what "the word equivalent of this" is for a given bulletin board's code. You'll need to experiment.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote