![]() |
|
#1
|
||||
|
||||
![]()
Why do the dotx files need to be opened? Or are you creating new documents based on them - an entirely different proposition?
For an active document, updating links can be as simple as: ActiveDocument.Fields.Update Silently saving a file merely requires the use of the SaveAs2 method. For example: Code:
With ActiveDocument .SaveAs2 FileName:=StrPth & StrNm & ".pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False .Close SaveChanges:=False End With Code:
Sub Demo() Dim i As Long, StrPth As String, StrNm As String, wdDoc As Document With Application.FileDialog(msoFileDialogOpen) .AllowMultiSelect = True If .Show = -1 Then StrPth = Left(.SelectedItems(1), InStrRev(.SelectedItems(1), "\")) 'Process each document For i = 1 To .SelectedItems.Count Set wdDoc = Documents.Open(FileName:=.SelectedItems(i), ReadOnly:=True, AddToRecentFiles:=False) With wdDoc .Fields.Update StrNm = .Bookmarks("docnumber").Range.Text & _ .Bookmarks("doctype ").Range.Text & _ .Bookmarks("sitename").Range.Text & _ .Bookmarks("personname").Range.Text .BuiltInDocumentProperties("Title") = StrNm 'Do your processing of the opened document here .SaveAs2 FileName:=StrPth & StrNm & ".pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False .Close SaveChanges:=False End With Next End If End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Refering figure number too text | danzi | Word | 1 | 01-20-2012 12:13 PM |
Refering to photos on other pages | woodfind | Word | 1 | 05-17-2010 01:52 AM |