+ Reply to Thread
Results 1 to 1 of 1

Problem with ThisWorkbook Module

  1. #1
    Registered User
    Join Date
    07-12-2011
    Location
    Bologna, Italy
    MS-Off Ver
    Excel 2007
    Posts
    1

    Problem with ThisWorkbook Module

    Hello,
    I'm having an issue with a macro i'm writing.

    I got a .xls file in which I have put a Workbook_Open and a Workbook_BeforeClose modules; all they do is to LOAD another .xls file, find the last row in it, write down the word "Open" (in _Open) or "Close" (in _BeforeClose), followed by the actualtime and the user that actually used the file. All works perfectly, if I open or close MANUALLY the file:

    Here's the code, pretty simple:


    Please Login or Register  to view this content.

    The problem: the main file (strWorkbookName) in which these modules reside is not designed to be edited manually, but through an UserForm residing in yet another file.

    When the UserForm code calls for strWorkbookName:

    Please Login or Register  to view this content.
    it opens regularly, and so does the "archive.xls" his Workbook_open calls for, but when it' being closed:

    Please Login or Register  to view this content.
    it steps through the _BeforeClose module without executing:
    - does NOT open "archive.xls"
    - does NOT go to cell "A1"
    - DOES loop through the Do Until...Loop, but since excel is locked on a non-empty cell, continues looping ad infinitum.

    What I did wrong?
    Last edited by docnadir; 07-12-2011 at 12:52 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1