Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Linda RQ[_2_] Linda RQ[_2_] is offline
external usenet poster
 
Posts: 2
Default File location auto text

Hi everyone,

Before I open up each document and do this one at a time I was wondering if
there is a way to add the auto text for file location to my documents all at
once?

I have about 100 documents in the same folder. The process I am planning is
to open the document/insert file location into the header or footer/print
each document. This is so 10 people have copies and the group can determine
which documents will be kept and which ones will go.

Thanks,
Linda


  #2   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default File location auto text

If you have all of the documents in a folder, running a macro containing the
following code will add the path and filename to the primary footer of the
first section of the document. Change the C:\test to whereever you have the
documents.

Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
Dim myrange As Range

PathToUse = "C:\Test\"
'Set the directory and type of file to batch process
myFile = Dir$(PathToUse & "*.doc")
While myFile ""
'Open document
Set myDoc = Documents.Open(PathToUse & myFile)
Set myrange = myDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange
myrange.Collapse wdCollapseStart
myDoc.Fields.Add myrange, wdFieldEmpty, "Filename \p"
myrange.Fields.Update
'Close the modified document after saving changes
myDoc.Close SaveChanges:=wdSaveChanges
'Next file in folder
myFile = Dir$()
Wend

See the article "What do I do with macros sent to me by other newsgroup
readers to help me out?" at:

http://www.word.mvps.org/FAQs/Macros...eateAMacro.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Linda RQ" wrote in message
...
Hi everyone,

Before I open up each document and do this one at a time I was wondering
if there is a way to add the auto text for file location to my documents
all at once?

I have about 100 documents in the same folder. The process I am planning
is to open the document/insert file location into the header or
footer/print each document. This is so 10 people have copies and the group
can determine which documents will be kept and which ones will go.

Thanks,
Linda



  #3   Report Post  
Posted to microsoft.public.word.newusers
Linda RQ[_2_] Linda RQ[_2_] is offline
external usenet poster
 
Posts: 2
Default File location auto text

Thanks Doug. The documents are on a network drive. Does that require any
additional text? I printed this and the Macro Instructions so when I get to
work tomorrow, it will be sitting there ready for me to try it. The "What
to do with a Macro" article is a great thing to add to this...I have worked
with very few macros and needed to be pulled along each step.

Linda


"Doug Robbins - Word MVP" wrote in message
...
If you have all of the documents in a folder, running a macro containing
the following code will add the path and filename to the primary footer of
the first section of the document. Change the C:\test to whereever you
have the documents.

Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
Dim myrange As Range

PathToUse = "C:\Test\"
'Set the directory and type of file to batch process
myFile = Dir$(PathToUse & "*.doc")
While myFile ""
'Open document
Set myDoc = Documents.Open(PathToUse & myFile)
Set myrange = myDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange
myrange.Collapse wdCollapseStart
myDoc.Fields.Add myrange, wdFieldEmpty, "Filename \p"
myrange.Fields.Update
'Close the modified document after saving changes
myDoc.Close SaveChanges:=wdSaveChanges
'Next file in folder
myFile = Dir$()
Wend

See the article "What do I do with macros sent to me by other newsgroup
readers to help me out?" at:

http://www.word.mvps.org/FAQs/Macros...eateAMacro.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Linda RQ" wrote in message
...
Hi everyone,

Before I open up each document and do this one at a time I was wondering
if there is a way to add the auto text for file location to my documents
all at once?

I have about 100 documents in the same folder. The process I am planning
is to open the document/insert file location into the header or
footer/print each document. This is so 10 people have copies and the
group can determine which documents will be kept and which ones will go.

Thanks,
Linda





  #4   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default File location auto text

Only the path to the folder where the files are located. (It would however
be a good idea to try it on a copy of the files in the first instance and
for that purpose, you might create a folder called Test on your Crive and
then copy the files there.)

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Linda RQ" wrote in message
...
Thanks Doug. The documents are on a network drive. Does that require any
additional text? I printed this and the Macro Instructions so when I get
to work tomorrow, it will be sitting there ready for me to try it. The
"What to do with a Macro" article is a great thing to add to this...I have
worked with very few macros and needed to be pulled along each step.

Linda


"Doug Robbins - Word MVP" wrote in message
...
If you have all of the documents in a folder, running a macro containing
the following code will add the path and filename to the primary footer
of the first section of the document. Change the C:\test to whereever
you have the documents.

Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
Dim myrange As Range

PathToUse = "C:\Test\"
'Set the directory and type of file to batch process
myFile = Dir$(PathToUse & "*.doc")
While myFile ""
'Open document
Set myDoc = Documents.Open(PathToUse & myFile)
Set myrange = myDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange
myrange.Collapse wdCollapseStart
myDoc.Fields.Add myrange, wdFieldEmpty, "Filename \p"
myrange.Fields.Update
'Close the modified document after saving changes
myDoc.Close SaveChanges:=wdSaveChanges
'Next file in folder
myFile = Dir$()
Wend

See the article "What do I do with macros sent to me by other newsgroup
readers to help me out?" at:

http://www.word.mvps.org/FAQs/Macros...eateAMacro.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Linda RQ" wrote in message
...
Hi everyone,

Before I open up each document and do this one at a time I was wondering
if there is a way to add the auto text for file location to my documents
all at once?

I have about 100 documents in the same folder. The process I am
planning is to open the document/insert file location into the header or
footer/print each document. This is so 10 people have copies and the
group can determine which documents will be kept and which ones will go.

Thanks,
Linda







Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
auto text file manny sue Microsoft Word Help 1 November 9th 07 06:03 AM
Update Auto Text (file name & path) Frank Microsoft Word Help 4 September 2nd 06 06:22 AM
How do I open a text file and have the info put in certain location of a form? tomc Microsoft Word Help 1 January 6th 06 06:36 AM
How do I export or convert auto text entries to a text file? flapolock Microsoft Word Help 3 December 30th 05 04:29 PM
AUTO SAVE LOCATION? Bobby28 Microsoft Word Help 1 January 31st 05 04:05 PM


All times are GMT +1. The time now is 03:36 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"