Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
hi i really need help!!
hi , right now im currently trying to add the filename and path to the top of
a document, which is no problem. THe problem is that I have to do the same to 1000 different documents. Is there a faster way instead of opening up each document manually to do that? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
hi i really need help!!
If you want to add same filename and path on each page, then you can use
header option available on insert tab. Once you enter the header will make information available on every page. "kris" wrote: hi , right now im currently trying to add the filename and path to the top of a document, which is no problem. THe problem is that I have to do the same to 1000 different documents. Is there a faster way instead of opening up each document manually to do that? |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
hi i really need help!!
Sorry, my answer is not correct.
I misunderstood the question. Thank you. "kris" wrote: hi , right now im currently trying to add the filename and path to the top of a document, which is no problem. THe problem is that I have to do the same to 1000 different documents. Is there a faster way instead of opening up each document manually to do that? |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
hi i really need help!!
It is possible to do this using a batch processing macro. The bigger problem
would occur if the documents were randomly created using a variety of templates and there was content already in the document header and if there was more than one header in the document, in which case where would you want to put the filename in relation to any headers already present? The following macro contains the basic code. It takes no account of existing headers nor will work with protected documents. It simply puts the filename at the end of the first page header. *Use on copies of the documents*. Sub BatchFileNamesinHeader() On Error GoTo err_FolderContents Dim myFile As String Dim DocList As String Dim DocDir As String Dim fDialog As FileDialog Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .Title = "Select Folder containing the documents to be modifed and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User" Exit Sub End If PathToUse = fDialog.SelectedItems.Item(1) If Right(PathToUse, 1) "\" Then PathToUse = PathToUse + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If myFile = Dir$(PathToUse & "*.do?") While myFile "" Set myDoc = Documents.Open(PathToUse & myFile) Selection.HomeKey Unit:=wdStory ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader With Selection .EndKey Unit:=wdStory .Font.name = "Arial" .Font.Size = "8" .ParagraphFormat.Alignment = wdAlignParagraphRight .TypeText ActiveDocument.FullName End With ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument myDoc.Close SaveChanges:=wdSaveChanges myFile = Dir$() Wend Application.ScreenUpdating = True Exit Sub err_FolderContents: MsgBox Err.Description Exit Sub End Sub http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org kris wrote: hi , right now im currently trying to add the filename and path to the top of a document, which is no problem. THe problem is that I have to do the same to 1000 different documents. Is there a faster way instead of opening up each document manually to do that? |