MATLAB: How to open the Header/Footer in a Word programatically from MATLAB

activexinterfacing with officeMATLAB

I have code to open up a word document and edit the body of the document; however I don't know how to open/edit the header/footer. Does anyone know how to do this?

Best Answer

I assume you want to access the header/footer in a Word document through Matlab m-script.
You can find these info in the Word help document, Microsoft Word Visual Basic Reference.
Here is the text regarding the Herder/Footer object:
Using the HeaderFooter Object Use Headers(index) or Footers(index), where index is one of the WdHeaderFooterIndex constants (wdHeaderFooterEvenPages, wdHeaderFooterFirstPage, or wdHeaderFooterPrimary), to return a single HeaderFooter object. The following example changes the text of both the primary header and the primary footer in the first section of the active document.
With ActiveDocument.Sections(1) .Headers(wdHeaderFooterPrimary).Range.Text = "Header text" .Footers(wdHeaderFooterPrimary).Range.Text = "Footer text" End With