![]() |
#1
|
|||
|
|||
![]()
Hi,
Requirement: Replace all italic text to tagged text.(<I>XXX</I>) Issue: ReplaceAll options skip some italic text in Endnotes and Footnotes Tried code: Sub Test() Dim sFindRange As Range For Each sFindRange In ActiveDocument.StoryRanges sFindRange.Find.ClearFormatting sFindRange.Find.Replacement.ClearFormatting sFindRange.Find.Font.DoubleStrikeThrough = False sFindRange.Find.Font.Italic = True sFindRange.Find.Replacement.Font.Italic = True sFindRange.Find.Replacement.Font.DoubleStrikeThrou gh = True sFindRange.Find.Execute FindText:="", Replacewith:="<I>^&</I>", Forward:=True, Wrap:=wdFindContinue, Format:=True, MatchCase:=False, MatchWholeWord:=False, MatchWildcards:=False, MatchSoundsLike:=False, MatchAllWordForms:=False, Replace:=wdReplaceAll Next End Sub Please help to resolve above mention problem, kindly let me know for any more details. Thanks in advance Sankar B |
#2
|
||||
|
||||
![]()
Hmm, if you remove the references to the StoryRanges collection, I think the macro should search the whole document automatically.
The alternative is to make sure that Word looks in all so-called story ranges. For the basic idea, take a look at the example macro at http://www.gmayor.com/installing_macro.htm. You should be able to use it as a starting point. Again, I don't think this approach will be necessary...
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Srivas | Word VBA | 14 | 12-03-2013 05:52 AM |
![]() |
redzan | Word VBA | 1 | 05-16-2013 08:25 AM |
How to make replace - well - REPLACE | lawrencehare | Word | 3 | 12-11-2012 12:00 AM |
![]() |
shabbaranks | Excel | 4 | 03-19-2011 08:38 AM |
Outlook 2007 Saved sent items list only holds the last ten items | david.peake | Outlook | 0 | 06-01-2010 07:27 PM |