![]() |
|
#1
|
|||
|
|||
![]()
Refined well Paul and Graham.
As a alternate to defining the parameter oDoc and passing wdDoc, you may be able to declare wdDoc at the module level and simply replace ActiveDocument (in my case) or oDoc (in Graham') with wdDoc. |
#2
|
|||
|
|||
![]()
Thanks alot guys especially Greg. I got it working in the main script but still can't get it going in a module it doesn't
know what I'm refering to when I use wdDoc but it does in the main script so that'll do. If it ain't broke..... This is what I ended up using anyway. Code:
arrTerms = Split("(\<italics\>)(*)(\<italics/\>)|(\<bold\>)(*)(\<bold/\>)|(\<indent\>)(*)(\<indent/\>)", "|") For lngIndex = 0 To UBound(arrTerms) Set wdRng = wdDoc.Range With wdRng.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:=wdReplaceAll End With Next This seems like super great code that I will use again but i can't really work out how it works could you please break it down for me. And say add another section that replaces <tab> with a vbtab. So I can compare and see how it works. Any explanations would be great. Below I have sort of explained how I see it. Actually probably better stated how I don't see it. Code:
|
![]() |
|
![]() |
||||
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 |