title: How to define left footer and right footer in word using VBA
body: <p>I currently have an excel file that generates a pdf page with left and right footers using the following code. </p>
  
  <pre><code>Set wsSig_Page = Worksheets("Signature Page")
  wsSig_Page.PageSetup.LeftFooter = sLeft_Footer
  wsSig_Page.PageSetup.RightFooter = sRight_Footer
  </code></pre>
  
  <p>sLeft_Footer and sRight_Footer are both strings. </p>
  
  <p>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.</p>
  
  <p>The word document is created and populated by an excel macro. </p>
  
  <p>EDIT: 
  My code to generate a new word doc is the following </p>
  
  <pre><code>Set wdApp = CreateObject("Word.Application")    
  Set wd = wdApp.Documents.Add
  </code></pre>
  
  <p>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. </p>
  
  <p>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.</p>
  
  <p>EDIT 2: Old code for footer. </p>
  
  <pre><code> 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" &amp; 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" &amp; 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, "&lt;TOTAL_PAGE_NUMBER&gt;", Total_Page_Count)
  
      If Len(sLeft_Footer) + Len(sRight_Footer) &gt; 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("&amp;09Page &amp;P+" &amp; Agreement_Page_Count &amp; " of &lt;TOTAL_PAGE_NUMBER&gt;", "&lt;TOTAL_PAGE_NUMBER&gt;", Total_Page_Count)
  
  
  End Sub
  </code></pre>