Word automation Header/Footer merge fields

bartwyckmansbartwyckmans Member Posts: 39

Does anyone know how to access merge fields into a header or footer?
in VB language is this
wrdRange := wrdApp.ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range

at this point you can 'loop' the wrdRange object and searching for the mergefields ....

but how do you code that in Navision ..... :shock:


  • Options
    NixPtNixPt Member Posts: 19
    I use this fuction of VB to edit the header:
    varword.ActiveWindow.ActivePane.View.SeekView(1); // -> to enter on section Header
    varword.ActiveWindow.ActivePane.View.SeekView(4); // -> to enter on section Footer. 
    varword.ActiveWindow.ActivePane.View.SeekView(0); // -> to enter on section Maindoc.

    You have the enumeration of vb on MSDN:


    I hope that helps. ](*,)
  • Options
    ajhvdbajhvdb Member Posts: 672
    Did you solve this. I would like to know too.
  • Options
    paulvgpaulvg Member Posts: 3
    This is a way to code this in Navision.
    Thanks to the enumeration link I know that I have to replace wdHeaderFooterPrimary by 1

    wrdDoc := wrdApp.ActiveDocument;
    wrdSections := wrdDoc.Sections;
    wrdHeaders :=wrdSections.Item(1).Headers;
    wrdHeaders.Item(1).PageNumbers.RestartNumberingAtSection := FALSE;
Sign In or Register to comment.