I currently have an excel file that generates a pdf page with left and right footers using the following code.
Set wsSig_Page = Worksheets("Signature Page")
wsSig_Page.PageSetup.LeftFooter = sLeft_Footer
wsSig_Page.PageSetup.RightFooter = sRight_Footer
sLeft_Footer and sRight_Footer are both strings.
My issue is that I'm now required to generate the pdf using a word document. I've gotten most of the formatting needed but I'm stuck trying to find the replacement to PageSetup.LeftFooter and PageSetup.RightFooter.
The word document is created and populated by an excel macro.
EDIT: My code to generate a new word doc is the following
Set wdApp = CreateObject("Word.Application")
Set wd = wdApp.Documents.Add
I currently don't have any code relating to adding footers to the word document because I don't know how to have two multi line sections appear inline (one on the left and one on the right) in the footer of the word document.
Using an excel worksheet was easy because it has LeftFooter and RightFooter as part of the properties of PageSetup. This is not the case in word.
EDIT 2: Old code for footer.
Sub Insert_Footer(Optional Hide_Macro As Boolean) Dim wsSig_Page As
Worksheet Dim wsAgreement As Worksheet Dim wsAgreement_Data As
Worksheet Dim Signature_Page_Count As Integer Dim Agreement_Page_Count
As Integer Dim Total_Page_Count As Integer Dim Replace_Tag_Array() As
String Dim Replace_Text_Array() As String Dim sLeft_Footer As String
Dim sRight_Footer As String Dim i As Integer
'MsgBox (wd.Range.Information(wdNumberOfPagesInDocument))
Set wsSig_Page = Worksheets("Signature Page")
Set wsAgreement = Worksheets("Agreement")
Set wsAgreement_Data = GetAgreementDataWorksheet()
iRow_End = wsSig_Page.Range("A2000").End(xlUp).row
Call Worksheet_Methods.Scroll_To_Location(wsSig_Page.Range("A" & iRow_End))
Signature_Page_Count = ExecuteExcel4Macro("Get.document(50,""Signature Page"")")
'iRow_End = wsAgreement.Range("A2000").End(xlUp).row
'Call Worksheet_Methods.Scroll_To_Location(wsAgreement.Range("A" & iRow_End))
'Agreement_Page_Count = ExecuteExcel4Macro("Get.document(50,""Agreement"")")
Agreement_Page_Count = wd.Range.Information(wdNumberOfPagesInDocument)
Total_Page_Count = Signature_Page_Count + Agreement_Page_Count + Worksheets("Form").Range("Field_Schedule_Page_Numbers").value
sLeft_Footer = wsAgreement_Data.Range("A2").value
Replace_Tag_Array() = Split(wsAgreement_Data.Range("D2").value, "|")
Replace_Text_Array() = Split(wsAgreement_Data.Range("E2").value, "|")
For i = 0 To UBound(Replace_Tag_Array)
sLeft_Footer = Replace(sLeft_Footer, Replace_Tag_Array(i), Replace_Text_Array(i))
Next
sRight_Footer = Replace(wsAgreement_Data.Range("A3").value, "<TOTAL_PAGE_NUMBER>", Total_Page_Count)
If Len(sLeft_Footer) + Len(sRight_Footer) > 254 Then
Set rRange = Worksheets("Form Data").Range("Table_Abr")
sString = Replace_Text_Array(1)
Replace_Text_Array(1) = Range("Abr_Text").value
sLeft_Footer = wsAgreement_Data.Range("A2").value
For i = 0 To UBound(Replace_Tag_Array)
sLeft_Footer = Replace(sLeft_Footer, Replace_Tag_Array(i), Replace_Text_Array(i))
Next
End If
wsSig_Page.PageSetup.LeftFooter = sLeft_Footer
wsSig_Page.PageSetup.RightFooter = Replace("&09Page &P+" & Agreement_Page_Count & " of <TOTAL_PAGE_NUMBER>", "<TOTAL_PAGE_NUMBER>", Total_Page_Count)
End Sub