Need Help With Macros

  • Thread starter Thread starter Toni
  • Start date Start date
T

Toni

HI!, I need some help with macros. I wanted to know if there is a way to
create a macro that will run through a series of documents at the same time
by only running it once. For instance if I had a number of documents in one
folder would it be possible to run a macro in each document in the folder by
running it in the first document only and therefore make the same changes in
the rest of the documents in that folder. I hope this is clear.
 
Hi Greg, that was really useful, i just want to make sure it is exactly what
I am looking for. Okay So I have 5 documents in one folder and I need the
headers to change. Would I use your Process to do that?. is there some part
of your process where I could type in the information that needed to be in
the header?
 
Yes. Basically that is all there is to it. You would open and edit the
UserDefined process in BatchProcesses.dot.

Something like this:

Function User_Defined(ByRef Doc As Word.Document) As String
On Error GoTo Err_Handler
'*******
Doc.StoryRanges(wdPrimaryHeaderStory).Text = "Header Text Here"
'*******
User_Defined = Doc.Name & " processed successfully."
Err_ReEntry:
Exit Function
Err_Handler:
User_Defined = Doc.Name & " failed to process. Error summary: " &
Err.Description & "."
Resume Err_ReEntry
End Function
 
Back
Top