Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to repeatedly set the format in word?
#7
I checked some of the information on the Internet, the word macro command can be resolved, as the following code, but I can not write part of the regular expression :oops:

Can I use QM to achieve the following functions? Tongue


Sub HighlightColor()
Dim mt, n&, m&, reg As Object
Set reg = CreateObject("vbscript.regexp")
reg.Global = True: reg.MultiLine = True
reg.Pattern = "(????????????????????????)"
For Each mt In reg.Execute(ActiveDocument.Content)
m = mt.FirstIndex: n = mt.Length
With ActiveDocument.Range(m, m + n)
.HighlightColorIndex = wdYellow
End With
Next
End Sub


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)