Word Automation of nested header fields

F

FlipperDo

Hi,

I try to add a field expression in headers und footers of Office 2007
documents.
It looks like this:
{IF {PAGE} > 2 { IF {PAGE} < { SECTIONPAGES} " – { = {PAGES} + 0 } – " }}

I had several approches to fill the range with the usual commands, like

param1 = (object)WdFieldType.wdFieldEmpty;
param2 = "";
param3 = false;
param4 = true;
doc.ActiveWindow.Selection.Fields.Add(dummyRange, ref param1, ref param2,
ref param3););

But the nesting of IF-statements does not succeed. it overwrites exsting
content. I also tried the way of dave Rado
(http://word.mvps.org/faqs/macrosvba/NestedFieldsWithVBA.htm), but no success.
Does anyone here have an idea, how to arrange the fields??

Many thanks in advance,

Stefan
 
Top