none
Workbook Close - Timing Issue ??? RRS feed

  • Question

  • I have an Addin that issues a

    WorkBooks(wkBName).close SaveChanges:=True

    which triggers a AfterSave event in that Workbook. The AfterSave event reads a text file to retrieve some data by executing a procedure in the Addin. The following is what occurs:

    1. The close statement above fails with the following message:

      "Method 'Close' of object'_Workbook' failed"
    2. However if I step through the procedure in "debug" mode, the process works perfectly.
    3. If I comment out the statements which read the text file, the procedure works perfectly, although of course I don't get what I want.

    Does anyone have any ideas as to what is happening here?

    Thursday, May 30, 2013 2:26 AM

Answers

  • I'm not sure why this had the effect it did, but the problem was resolved by removing a Workbook.Activate statement in the AfterSave Event.

    • Marked as answer by CatFelix Thursday, May 30, 2013 6:52 AM
    Thursday, May 30, 2013 6:52 AM