Microsoft Office Forums Find and Replace within range

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-18-2010, 12:20 AM
anil3b2 anil3b2 is offline Find and Replace within range Windows XP Find and Replace within range Office 2003
Novice
Find and Replace within range
 
Join Date: May 2010
Posts: 7
anil3b2 is on a distinguished road
Default Find and Replace within range

Hi All,

I have selected one para and i need to find and replace something like below but it replaces in all places in the document rather than within that range/selection. In the below code instead "myrange" if i use "Selection." then also i get the same result. Please help me.

With myrange.Find
.text = "<([0-9]{1,5})>([-|^=])<([0-9]{1,5})>"
.Replacement.text = "<Pages>^&</Pages>"


.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWildcards = True
End With
Do While myrange.Find.Execute
msgbox(selection.text)
Loop
Reply With Quote
  #2  
Old 11-18-2010, 05:06 AM
Kimberly Kimberly is offline Find and Replace within range Windows 7 Find and Replace within range Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

Selection.Replace What:="<([0-9]{1,5})>([-|^=])<([0-9]{1,5})>", Replacement _
:="<Pages>^&</Pages>", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase _
:=False, SearchFormat:=False, ReplaceFormat:=False
Reply With Quote
  #3  
Old 11-18-2010, 05:17 AM
anil3b2 anil3b2 is offline Find and Replace within range Windows XP Find and Replace within range Office 2003
Novice
Find and Replace within range
 
Join Date: May 2010
Posts: 7
anil3b2 is on a distinguished road
Default

Thanks for your reply. is n't it not support with Do while option, since i am trying to apply XML schema in the loop. Like below.

Do While myrange.Find.Execute
msgbox(selection.text)
ActiveDocument.XMLNodes.Add "Pages", "Schema"
Loop

it would be grate that if i get the below thru find and replace.

In a selected para only i need to find Pages and i need to apply xml tag <Page> and then with in the pages the first page should be with <Fp> and another with <Lp>.
Reply With Quote
  #4  
Old 12-01-2010, 02:35 AM
anil3b2 anil3b2 is offline Find and Replace within range Windows XP Find and Replace within range Office 2003
Novice
Find and Replace within range
 
Join Date: May 2010
Posts: 7
anil3b2 is on a distinguished road
Default

Can anybody help me on this?
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
find and replace anil3b2 Word 0 08-03-2010 11:30 PM
help with find and replace sjkiss Word 1 04-12-2010 08:08 AM
find and replace graphics thegeester Drawing and Graphics 0 04-04-2010 04:36 AM
Find /Replace Help ilcaa Word 2 11-02-2009 08:41 AM
Find and Replace Macro - A Better Way Tribos Word VBA 0 10-08-2008 03:22 AM


All times are GMT -7. The time now is 02:48 AM.


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