Hi there,
Thanks for the revert.
Well I am creating a tool in access vba, where in browse and selecting multiple word file only and getting them updated with the footer.
Below is the code for the same.....
Dim word As word.Application
Dim document As word.document
Dim wrdSelection As word.Selection
Dim strDocPath As String
Dim fDialog As FileDialog
' Set up the File Dialog. '
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
Dim varFile As Variant
With fDialog
.AllowMultiSelect = True
.Title = "Select File Location to Export docx :"
.InitialFileName = ""
If .Show = True Then
For Each varFile In .SelectedItems
GetFileName = varFile
strDocPath = GetFileName
Set word = CreateObject("Word.Application")
word.Visible = True
word.Documents.Open (strDocPath)
With ActiveDocument.Sections(1)
.Headers(wdHeaderFooterPrimary).Range.Text = "Header text"
.Footers(wdHeaderFooterPrimary).Range.Text = "Footer text"
End With
ActiveDocument.Save
ActiveDocument.Close
Set word = Nothing
Set doc = Nothing
Set wrdSelection = Nothing
Next
End If
End With
Set word = Nothing
Set document = Nothing
MsgBox "Updated Successfully"
And i get error in the code...
With ActiveDocument.Sections(1)
.Headers(wdHeaderFooterPrimary).Range.Text = "Header text"
.Footers(wdHeaderFooterPrimary).Range.Text = "Footer text"
End With
Requesting if could help me.
Thanks,
Rakesh