Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2013, 10:17 AM
alysolyman alysolyman is offline Mass replacing word(s) Windows 7 32bit Mass replacing word(s) Office 2003
Novice
Mass replacing word(s)
 
Join Date: Feb 2013
Posts: 12
alysolyman is on a distinguished road
Default Mass replacing word(s)

Good Day,
I have a big number of word files containing text.
after finalizing the files, I found out that I need to replace some particular repeated words in all the files.



It's not practical to open each file and replace the text and then open the next file.

is there any way to replace some text in multiple files at one time with a new text

Thanks in advance
Reply With Quote
  #2  
Old 02-17-2013, 02:21 AM
macropod's Avatar
macropod macropod is offline Mass replacing word(s) Windows 7 64bit Mass replacing word(s) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Hi alysolyman,

Is this just a couple of words that need replacing in each file, or a large list?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-17-2013, 07:51 AM
gmaxey gmaxey is offline Mass replacing word(s) Windows 7 32bit Mass replacing word(s) Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

This may work for you:
http://gregmaxey.com/word_tip_pages/...d_replace.html
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #4  
Old 02-18-2013, 03:02 PM
fumei fumei is offline Mass replacing word(s) Windows 7 64bit Mass replacing word(s) Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

If it is a simple replace over a number of files, using DIR would be the simplest way to go.
Reply With Quote
  #5  
Old 02-18-2013, 07:31 PM
macropod's Avatar
macropod macropod is offline Mass replacing word(s) Windows 7 64bit Mass replacing word(s) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Hir Gerry,
Quote:
Originally Posted by fumei View Post
If it is a simple replace over a number of files, using DIR would be the simplest way to go.
I'm sure you realize it's a little more complicated than that ... I suspect Greg's Addin uses the Dir command for the batch processing option.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 02-19-2013, 01:55 AM
fumei fumei is offline Mass replacing word(s) Windows 7 64bit Mass replacing word(s) Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

Hi Paul. I am sure Greg's addin does use DIR. It is a very useful tool.

My point was that if it is a simple (say a single word or phrase) operation, then it actually is NOT all that complicated.
Code:
Sub ChangeSomething()
Dim file
Dim path As String
Dim r As Range
path = "c:\ThisOne\"
file = Dir(path & "*.doc")
Do While file <> ""
   Documents.Open path & file
   Set r = ActiveDocument.Range
   r.Find.Execute FindText:="this phrase", _
      ReplaceWith:="booga booga whatever", Replace:=wdReplaceAll
   ActiveDocument.Save
   ActiveDocument.Close
   file = Dir()
Loop
End Sub
All Word docs in the ThisOne folder get the phrase changed. Yes, for sure, the addin is handy, and it works. However, again, if it is a simple operation, then performing that action on all files in a folder is also simple.

The OP asked: "is there any way to replace some text in multiple files at one time with a new text"

The answer of course is, yes.
Reply With Quote
  #7  
Old 02-21-2013, 12:15 AM
alysolyman alysolyman is offline Mass replacing word(s) Windows 7 32bit Mass replacing word(s) Office 2003
Novice
Mass replacing word(s)
 
Join Date: Feb 2013
Posts: 12
alysolyman is on a distinguished road
Default

Thanks a lot to all of you
Reply With Quote
  #8  
Old 02-21-2013, 12:25 AM
alysolyman alysolyman is offline Mass replacing word(s) Windows 7 32bit Mass replacing word(s) Office 2003
Novice
Mass replacing word(s)
 
Join Date: Feb 2013
Posts: 12
alysolyman is on a distinguished road
Default

dear fumei,
does this code also works with sub-directories or only the main directory?
Reply With Quote
  #9  
Old 02-27-2013, 01:45 PM
gmaxey gmaxey is offline Mass replacing word(s) Windows 7 32bit Mass replacing word(s) Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Paul, Gerry

The add-in uses a scripting.filesystem object.

Alysolymna, No Gerry's Dir example doesn't process sub-folders. The add-in does.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #10  
Old 02-27-2013, 01:53 PM
alysolyman alysolyman is offline Mass replacing word(s) Windows 7 32bit Mass replacing word(s) Office 2003
Novice
Mass replacing word(s)
 
Join Date: Feb 2013
Posts: 12
alysolyman is on a distinguished road
Default

Thanks for your reply. do you have a link to download the add-in.
sorry for bothering you.
Reply With Quote
  #11  
Old 02-27-2013, 01:56 PM
macropod's Avatar
macropod macropod is offline Mass replacing word(s) Windows 7 64bit Mass replacing word(s) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Quote:
Originally Posted by alysolyman View Post
Thanks for your reply. do you have a link to download the add-in.
sorry for bothering you.
Greg already provided that in post #3 in this thread.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mass editing of hyperlinks Michael137 PowerPoint 0 10-29-2012 02:44 AM
Mass replacing word(s) Prevent OOO reply when sending a mass email tdmag62 Outlook 1 11-30-2011 09:27 PM
Mass replacing word(s) Word replacing problem!!!! Jamal NUMAN Word 2 07-08-2011 03:56 AM
Mass replacing word(s) Mass e-mail seperation daryl Mail Merge 1 03-23-2010 03:45 PM
Mass replacing word(s) Mass attachment downloads? dpool2002 Outlook 1 06-21-2006 02:11 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:22 AM.


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