Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2014, 04:34 AM
Sankar Tech Sankar Tech is offline ReplaceAll option is not replace all items Windows XP ReplaceAll option is not replace all items Office 2007
Novice
ReplaceAll option is not replace all items
 
Join Date: Jan 2014
Posts: 8
Sankar Tech is on a distinguished road
Default ReplaceAll option is not replace all items

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
Reply With Quote
  #2  
Old 01-04-2014, 10:50 AM
Stefan Blom's Avatar
Stefan Blom Stefan Blom is offline ReplaceAll option is not replace all items Windows 7 64bit ReplaceAll option is not replace all items Office 2013
Moderator
 
Join Date: Aug 2011
Posts: 4,000
Stefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to all
Default

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
ReplaceAll option is not replace all items How to find&replace several items at once? Srivas Word VBA 14 12-03-2013 05:52 AM
ReplaceAll option is not replace all items How do I find and replace multiple items at once? 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
ReplaceAll option is not replace all items Help with find and replace or query and replace 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

Other Forums: Access Forums

All times are GMT -7. The time now is 05:39 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft