Run macro upon all files within a folder

  • Follow


Word 2007

Dear Gurus:  

I am attempting to find a macro that would possibly run an already existing 
macro upon all files within a specific folder.  

For example:  I need to convert all existing styles within a series of 
resumes to styles newly created in a template by someone else.  

I have created the macro that will make the style conversions, but I am 
further in need of a process by which this macro can be automatically applied 
to all files within a given folder.  

Any assistance in this regard will be greatly appreciated.  

Thanks - Rod


0
Reply Utf 12/18/2009 3:09:01 PM

Hi Rod,
Have a look at this article http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

HTH,
Dave
0
Reply Utf 12/18/2009 3:46:01 PM


Hello Dave:  

Thanks so much for your quick and helpful response.  I had previously 
checked out and actually made use of the link to which you directed me.  My 
problem seems to be that I remain perplexed by VBA.  

I would have no idea how to modify the coding so that I could incorporate an 
existing macro instead of using the *find and replace* feature.  

If you are able to shed any further light on the subject or the necessary 
modifications I would need to make, I would continue to be very appreciative. 
 

Thanks Again - Rod


"DaveLett" wrote:

> Hi Rod,
> Have a look at this article http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm
> 
> HTH,
> Dave
0
Reply Utf 12/21/2009 9:35:01 PM

Sub TheStuffToDo()
' the coding to do the processing on each opened file
' yadda yadda
' yadda yadda
End Sub

Sub DoItNow()
Dim file
Dim path As String

' the path to the folder
' make SURE you include the terminating "\"
Path = "c:\yadda\whatever\"

file = Dir(path & "*.doc")
Do While file <> ""
    Documents.Open Filename:=path & file
        ' call to macro that does whatever
       '  one would assume it is using ActiveDocument!
      CALL TheStuffToDo
      ' assuming you want to save the current file
      ActiveDocument.Save
      ActiveDocument.Close
     ' set file to next in Dir
     file = Dir()
Loop
End Sub

In other words, use Dir to GET each file, and then CALL to the macro you
already have to do the actions.
RPMitchal wrote:
>Hello Dave:  
>
>Thanks so much for your quick and helpful response.  I had previously 
>checked out and actually made use of the link to which you directed me.  My 
>problem seems to be that I remain perplexed by VBA.  
>
>I would have no idea how to modify the coding so that I could incorporate an 
>existing macro instead of using the *find and replace* feature.  
>
>If you are able to shed any further light on the subject or the necessary 
>modifications I would need to make, I would continue to be very appreciative. 
> 
>
>Thanks Again - Rod
>
>> Hi Rod,
>> Have a look at this article http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm
>> 
>> HTH,
>> Dave

-- 
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200912/1

0
Reply Fumei2 12/21/2009 10:30:21 PM

Fumei:  

Thanks so much.  I can't tell you just how much I appreciate the assistance 
and feedback that I receive from the Forum.  

Rod


"Fumei2 via OfficeKB.com" wrote:

> Sub TheStuffToDo()
> ' the coding to do the processing on each opened file
> ' yadda yadda
> ' yadda yadda
> End Sub
> 
> Sub DoItNow()
> Dim file
> Dim path As String
> 
> ' the path to the folder
> ' make SURE you include the terminating "\"
> Path = "c:\yadda\whatever\"
> 
> file = Dir(path & "*.doc")
> Do While file <> ""
>     Documents.Open Filename:=path & file
>         ' call to macro that does whatever
>        '  one would assume it is using ActiveDocument!
>       CALL TheStuffToDo
>       ' assuming you want to save the current file
>       ActiveDocument.Save
>       ActiveDocument.Close
>      ' set file to next in Dir
>      file = Dir()
> Loop
> End Sub
> 
> In other words, use Dir to GET each file, and then CALL to the macro you
> already have to do the actions.
> RPMitchal wrote:
> >Hello Dave:  
> >
> >Thanks so much for your quick and helpful response.  I had previously 
> >checked out and actually made use of the link to which you directed me.  My 
> >problem seems to be that I remain perplexed by VBA.  
> >
> >I would have no idea how to modify the coding so that I could incorporate an 
> >existing macro instead of using the *find and replace* feature.  
> >
> >If you are able to shed any further light on the subject or the necessary 
> >modifications I would need to make, I would continue to be very appreciative. 
> > 
> >
> >Thanks Again - Rod
> >
> >> Hi Rod,
> >> Have a look at this article http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm
> >> 
> >> HTH,
> >> Dave
> 
> -- 
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.aspx/word-programming/200912/1
> 
> .
> 
0
Reply Utf 12/29/2009 8:24:01 PM

4 Replies
2001 Views

(page loaded in 0.089 seconds)

Similiar Articles:
















7/18/2012 6:58:54 PM


Reply: