Publisher 2013 VBA makes document crash on close RRS feed

  • Question

  • Hi,

    I posted this on the normal MS forums and haven't gotten any luck. Hoping maybe someone here will know.

    I created a Publisher trifold at my company in Office 2010 a few years ago. It uses a VBA form to allow my team to easily insert user information into the document.

    I certainly wouldn't call myself a pro with VBA but it worked incredibly well in Publisher 2010 and never crashed. After our team updated to Office 2013, the exact same code is causing it to crash when you close the document. Obviously this isn't a huge deal since users are able to open the document, run the macro and save or print it out but it is certainly frustrating.

    I have done some troubleshooting and narrowed it down to some kind of issue with the FindReplace function in Publisher. I confirmed this by creating a blank Pub document, inserting just the stock MS example VBA code into it, and saving.

    This is the code:

    Sub ExecuteFindReplace()
     Dim objFindReplace As FindReplace
     Set objFindReplace = ActiveDocument.Find
     With objFindReplace
     .FindText = "library"
     End With
    End Sub

    The same thing happens where after running the macro and closing the doc the "MS Publisher has stopped working" box appears with the following details:

    Problem signature:
      Problem Event Name:    BEX64
      Application Name:    MSPUB.EXE
      Application Version:    15.0.4569.1503
      Application Timestamp:    52b0bf98
      Fault Module Name:    unknown
      Fault Module Version:
      Fault Module Timestamp:    00000000
      Exception Offset:    0000014014e3d000
      Exception Code:    c0000005
      Exception Data:    0000000000000008
      OS Version:    6.1.7601.
      Locale ID:    1033

    Additional information about the problem:
      LCID:    1033
      skulcid:    1033

    Is there something with 2013 VBA in publisher I am doing wrong? Anyone else hit this problem? It doesn't seem to happen if I try the equivalent code in Word, and I have some VBA Word docs that work with no issues.

    Friday, February 12, 2016 3:29 PM