View Single Post
 
Old 03-28-2016, 09:06 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Either way, you should make some small changes to the macro to run it from another application e.g. as follows - call it with MyReplacements wdDoc

Code:
Sub MyReplacements(oDoc As Object)
'A basic Word macro coded by Greg Maxey
'as modified by Graham Mayor ;)
Dim arrTerms() As String
Dim oRng As Object
Dim lngIndex As Long
    arrTerms = Split("(\<italics\>)(*)(\<italics/\>)|(\<bold\>)(*)(\<bold/\>)|(\<indent\>)(*)(\<indent/\>)", "|")
    For lngIndex = 0 To UBound(arrTerms)
        Set oRng = oDoc.Range
        With oRng.Find
            .Text = arrTerms(lngIndex)
            .MatchWildcards = True
            Select Case lngIndex
                Case 0: .Replacement.Font.Italic = True
                Case 1: .Replacement.Font.Bold = True
                Case 2: .Replacement.ParagraphFormat.LeftIndent = 72
            End Select
            .Replacement.Text = "\2"
            .Execute Replace:=2
        End With
    Next
lbl_Exit:
    Set oRng = Nothing
    Set oDoc = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote