Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-06-2016, 05:04 AM
PRA007's Avatar
PRA007 PRA007 is offline How to do multiple find and replace in string. Windows 7 64bit How to do multiple find and replace in string. Office 2010 32bit
Competent Performer
How to do multiple find and replace in string.
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default How to do multiple find and replace in string.

While parsing response text obtained from website using winhttp, I am cleaning it to remove unnecessary text like this.



Code:
StrTxt = Replace(StrTxt, "<CENTER><b><i>Claims</b></i></CENTER> <HR> <BR><BR>", "")
StrTxt = Replace(StrTxt, "What is claimed is: <BR><BR>", "")
StrTxt = Replace(StrTxt, "I claim: <BR><BR>", "")
StrTxt = Replace(StrTxt, "We claim: <BR><BR>", "")
Is there any one line code using array or something to remove all the strings at once?
I know how to do that in range fro earlier posts. I don't know how to extrapolate that knowledge to string.
Reply With Quote
  #2  
Old 01-06-2016, 03:29 PM
macropod's Avatar
macropod macropod is offline How to do multiple find and replace in string. Windows 7 64bit How to do multiple find and replace in string. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could use:
Code:
StrTxt = Replace(Replace(Replace(StrTxt, "<CENTER><b><i>Claims</b></i></CENTER> <HR> <BR><BR>", ""), "What is claimed is: <BR><BR>", ""), "I claim: <BR><BR>", ""), "We claim: <BR><BR>", "")
but that's probably no more efficient and is much harder to read & maintain.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-06-2016, 09:10 PM
PRA007's Avatar
PRA007 PRA007 is offline How to do multiple find and replace in string. Windows 7 64bit How to do multiple find and replace in string. Office 2010 32bit
Competent Performer
How to do multiple find and replace in string.
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default

Ok. I will stick with current method.
Reply With Quote
Reply

Tags
vba, wordvba



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to do multiple find and replace in string. Find Multiple Wildcard string and Highlight PRA007 Word VBA 2 10-17-2015 01:07 AM
How to do multiple find and replace in string. How do I find and replace multiple items at once? redzan Word VBA 1 05-16-2013 08:25 AM
How to do multiple find and replace in string. Find and replace a string of text errtu Word 1 01-31-2013 02:09 PM
How to do multiple find and replace in string. Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
How to do multiple find and replace in string. Find and Replace multiple lines/paragraphs jcw Word 1 11-18-2011 11:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:23 PM.


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