none
How to force the type of ListNum format when inserting a ListNum field in a Word document RRS feed

  • Question

  • I have created a "MultiLevel" field in the Normal template. Now I want to add an item for one of the levels of that field into a document. When I go to QuickParts>Fields>ListNum I can see my new list ("FavList") in the list of possible format, just above "LegalDefault", but when I try to insert the field programmatically (using vb.net code) I can't see how to get the field to use the FavList type of list. Here's my code:

    with selection

                .Fields.Add(Range:=.Range, Type:=WdFieldType.wdFieldListNum, Text:=" \L7", PreserveFormatting:=False)

    end with

    I didn't add any reference to "FavList" because I couldn't find anywhere in the allowed arguments to add it. I tried adding it to the end of the field type:

                .Fields.Add(Range:=.Range, Type:=WdFieldType.wdFieldListNum.FavList, Text:=" \L7", PreserveFormatting:=False)

    but that didn't work. Is there a way to do this?


    Robert Homes

    Wednesday, June 24, 2015 3:44 PM

Answers

  • Hi Robert,

    >> but when I try to insert the field programmatically (using vb.net code) I can't see how to get the field to use the FavList type of list.

    You could use the FavList type in the Text Parameter, a simple demo as below:

    oDoc.Fields.Add(Range:=oDoc.Range, Type:=Word.WdFieldType.wdFieldListNum, Text:="FavList \L3") 

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, June 25, 2015 9:11 AM