Hello,
Please, can anyone help me with this? I am trying to add a Table on the header of a word document but i can't figure out the proper way to do it.
The code below creates a table but it is created in the body of the word document not on the header. Please help.
I am using the below code in my Ms Access application:
Please, can anyone help me with this? I am trying to add a Table on the header of a word document but i can't figure out the proper way to do it.
The code below creates a table but it is created in the body of the word document not on the header. Please help.
I am using the below code in my Ms Access application:
Code:
Sub AddHeaderWithTable()
Dim Doc
Dim intX As Integer
Dim intY As Integer
Dim i As Integer
Dim docToOpen As FileDialog
Set docToOpen = Application.FileDialog(msoFileDialogFilePicker)
docToOpen.Show
For i = 1 To docToOpen.SelectedItems.Count
'Open each document
Set Doc = Documents.Open(filename:=docToOpen.SelectedItems(i))
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables.Add Range:=myRange, NumRows:=2, NumColumns:=3
Doc.Save
Doc.Close
Next i
End Sub
Last edited: