Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-10-2014, 05:26 PM
rsrasc rsrasc is offline Need Macro to Replace Text Windows 7 64bit Need Macro to Replace Text Office 2010 64bit
Competent Performer
Need Macro to Replace Text
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default Need Macro to Replace Text

I have the following text in a document:



A. This answer is incorrect.
B. This answer is incorrect.
C. This answer is incorrect.
D. Answer D is correct.


This is the output that I would like to get with a macro/code :

Answer (A) is incorrect.
Answer (B) is incorrect.
Answer (C) is incorrect
Answer (D) is correct.




Thanks!
Reply With Quote
  #2  
Old 11-10-2014, 06:09 PM
macropod's Avatar
macropod macropod is offline Need Macro to Replace Text Windows 7 64bit Need Macro to Replace Text 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 don't need a macro for that - you can use a wildcard Find/Replace, where:
Find = ([A-Z]).*[Aa]nswer*( is[ in]{1,3}correct.)
Replace = Answer (\1)\2
Of course, you could incorporate it into a macro such as the last one I gave you ...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-10-2014, 06:26 PM
rsrasc rsrasc is offline Need Macro to Replace Text Windows 7 64bit Need Macro to Replace Text Office 2010 64bit
Competent Performer
Need Macro to Replace Text
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default

Thanks! Working great!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Macro to Replace Text Macro to find text and replace with form field containing that text iiiiifffff Word VBA 16 06-04-2016 01:47 AM
Need Macro to Replace Certain Text rsrasc Word VBA 2 10-24-2014 06:05 AM
Help: how to replace hidden text with unhidden text when typing over jdcornelius Word 6 03-28-2014 01:19 PM
Need Macro to Replace Text Word VBA Macro to Find and Replace based on the Alt Text of an Image bennymc Word VBA 1 01-27-2014 04:23 PM
Need Macro to Replace Text Macro to Replace Fonts ballj_35 Word 3 05-10-2011 01:10 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:00 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