none
Microsoft Word Enumerated Constants not found when compiling

    Question

  • 

    Hi,

    I'm upgrading a Visual Basic program to VB.NET with Visual Studio 2013 and Microsoft Word 2013.

    The code performs some manipulation of Word documents.

    It includes references to some enumerated constants such as wdExtend and wdCharacter in a Selection.EndOf statement.

    However I get a number of compile errors, like: 'WdExtend' is not declared. It may be inaccessible due to it's protection level.

    I have added a reference to Microsoft Word 15.0 Object Library, and the program compiles fine except for the above errors.

    Is there something else I need to do to import the Microsoft Office enumerated constants?

    Thanks.

    Wednesday, April 5, 2017 10:30 AM

All replies

  • You could use an Imports statement, but I would fully qualify the enumerated constants:

    Microsoft.Office.Interop.Word.WdMovementType.wdExtend

    Or

    Imports Microsoft.Office.Interop.Word

    and then use:

    WdMovementType.wdExtend


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, April 5, 2017 12:41 PM