Help with creating nested IF

S

Sajid

Hi:

I want to create the following field in the header of my document in C#
and not VBA. I have the VBA code but it doesnt convert corectly to C#;

{ IF {PAGE}<="5""BASIC"{ IF {PAGE}>="10""BASIC2"}}

VBA Code:

Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="IF"
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="PAGE"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:="<=""6""""BASIC """
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="IF"
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="PAGE"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=">=""8""""BASIC """

Can someone please help me convert this to C#.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top