Getting a lot of Error 5097 in VBA RRS feed

  • Question

  • Hello,

    I have an Word add-in based on Visual Basic for Applications that is running perfectly on my computer. On the computer of my client it is not. A lot of error 5097 occur. The client uses Bitlocker and Defender. After both disabling them and excluded the files of the add-in in Defender. The same errors occur. What could cause these errors? Where to look for a solutions?

    Thanks for any clue.


    Gerben van der Heide

    Friday, February 1, 2019 11:29 AM

All replies

  • Did you do a web search for "VBA error 5097"? Before anyone here can help, you will at least need to tell us what your code is doing when that error occurs and, preferably, include the relevant portion of your code.

    Paul Edstein
    [MS MVP - Word]

    Friday, February 1, 2019 9:32 PM
  • Hello Paul and others,

    I have some more information about this issue.

    The applications makes a document based upon a template. Like this.

    strFilePath = 'c:\Templates\'
    strFileName = 'Letter.dotx'

    Set mobjWordApp = Word.application
    With mobjWordApp
       .Documents.Add Template:=strFilePath+strFileName
    End With

    I found out that the document that is produced is not fully accessable. Here you see the file information of the Word document with the options I get. Normally you get more options for example the information of the file and document properties.

    The few file properties of a document

    When I try in the code access to the document like reading CustomDocumentProperties or reading a Bookmark it gives an error 5097.

    Error 5097 Word has encountered a problem

    Hopefully this gives a clue to where it goes wrong.



    Monday, February 4, 2019 10:32 AM
  • The lack of additional information is most likely because the document created from your template has not yet been saved.

    Have you checked that the named Custom Document Properties exist in the template?

    Paul Edstein
    [MS MVP - Word]

    Monday, February 4, 2019 11:51 AM