Compile Error: User-defined type not defined despite referencing Word Object Library RRS feed

  • Question

  • Hello,

    As per captioned title, I have encountered "Compile Error: User-defined type not defined" when running the below line with VBA in excel. 

    Dim WordApp As Word.Application

    However, I have already added a reference to the word library (Tools>Rerefences>Microsoft Word 16.0 Object Library).

    What else can i do to fix the error? 

    Many thanks!

    Tuesday, December 15, 2020 6:40 AM

All replies

  • when running the below line with VBA in excel

    Then you should ask in an Excel forum; this one is for Microsoft Access databases.

    If this happened in Access I would say it's time to decompile the application. But there is no such thing in Excel afaik, so ask there.

    -Tom. Microsoft Access MVP

    Tuesday, December 15, 2020 1:45 PM