Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
filelocations in worddocument
Okay,
I know how to get the { Filename \p } in the footer and how to update it manually. I want a .dot file, which will be saved as normal.dot for all users here to use it. But what I want is that after I put in that line it automatically updates the filelocation with path after I save or after it could be changed. Cause from what I can see now is that it doesn't automatically updates the filename and I have to press F9 or Alt-F9 in Word 2003. How can I do this or some advice please. Best regards, René Klomp |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
filelocations in worddocument
Use an autoopen macro in the new template to update the fields in the
documents created from it. You can use the code at http://www.gmayor.com/installing_macro.htm (rename the update macro Sub AutoOpen() ) -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org wrote: Okay, I know how to get the { Filename \p } in the footer and how to update it manually. I want a .dot file, which will be saved as normal.dot for all users here to use it. But what I want is that after I put in that line it automatically updates the filelocation with path after I save or after it could be changed. Cause from what I can see now is that it doesn't automatically updates the filename and I have to press F9 or Alt-F9 in Word 2003. How can I do this or some advice please. Best regards, René Klomp |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
filelocations in worddocument
I am going to try this later today, thank you for your response.
Does anyone know a simple way to put aa file location footer in existing documents? Best regards, René |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
filelocations in worddocument
If you mean insert into the currently open document then
Sub InsertFilenameFooter() With ActiveDocument If Len(.Path) = 0 Then .Save End If End With Selection.EndKey Unit:=wdStory ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter Selection.Fields.Add Range:=Selection.Range, _ Type:=wdFieldFileName, Text:="\p", _ PreserveFormatting:=False With ActiveWindow.ActivePane.View .SeekView = wdSeekMainDocument End With End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org wrote: I am going to try this later today, thank you for your response. Does anyone know a simple way to put aa file location footer in existing documents? Best regards, René |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
filelocations in worddocument
Hehe what I mean is that there are like thousands of files that don't
have the filename in the document. Is there a quick way to get the filename in the footer for all... Maybe I am too hopefull |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
filelocations in worddocument
Use the following instead - however I would test on copies of the files.
Sub BatchAddFilename() Dim myFile As String Dim PathToUse As String Dim MyDoc As Document Dim iFld As Integer With Dialogs(wdDialogCopyFile) If .Display 0 Then PathToUse = .Directory Else MsgBox "Cancelled by User" Exit Sub End If End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If If Left(PathToUse, 1) = Chr(34) Then PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2) End If myFile = Dir$(PathToUse & "*.do?") While myFile "" Set MyDoc = Documents.Open(PathToUse & myFile) Selection.EndKey Unit:=wdStory ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter Selection.EndKey Unit:=wdStory Selection.Fields.Add Range:=Selection.Range, _ Type:=wdFieldFileName, Text:="\p", _ PreserveFormatting:=False With ActiveWindow.ActivePane.View .SeekView = wdSeekMainDocument End With MyDoc.Close SaveChanges:=wdSaveChanges myFile = Dir$() Wend End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org wrote: Hehe what I mean is that there are like thousands of files that don't have the filename in the document. Is there a quick way to get the filename in the footer for all... Maybe I am too hopefull |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
filelocations in worddocument
See
How to Find & ReplaceAll on a Batch of Documents in the Same Folder http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm Replace text on a batch of files http://www.gmayor.com/batch_replace.htm http://gregmaxey.mvps.org/VBA_Find_And_Replace.htm One or more of these articles should give you a starting point for inserting text in a batch of documents. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. wrote in message oups.com... Hehe what I mean is that there are like thousands of files that don't have the filename in the document. Is there a quick way to get the filename in the footer for all... Maybe I am too hopefull |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
filelocations in worddocument
In the script of Graham, how do I let it place an enter before
importing the file location in the document? Thanks |