![]() |
#5
|
||||
|
||||
![]()
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding tables to Created word document whilst other word document open Help | rpb925 | Word VBA | 18 | 03-30-2016 04:45 PM |
![]() |
JennJenn79 | Word | 1 | 07-16-2015 09:34 PM |
![]() |
TDOG | Word | 1 | 10-12-2014 03:37 PM |
Copy format created by a conditional formatting | spk | Excel | 2 | 04-10-2013 04:41 AM |
Word crashing on "sort" routine | Kayale | Word | 0 | 04-12-2010 04:54 PM |