+ Reply to Thread
Results 1 to 2 of 2

Import module then run code not working.

  1. #1
    R-Enemy
    Guest

    Import module then run code not working.

    For some reason this isn't working and it's driving me crazy...

    I have a module called updater. Inside this module I have a blank sub called
    runUpdates. I have to have a blank sub when the program starts or it throws
    an error.

    Sub runUpdates()

    End Sub

    I have a different module and sub that is supposed to remove updater, then
    import the new updater with the sub runUpdates filled with code to update
    the changes needed. The code is:

    Sub checkUpdates()
    'code is here to check version number and see if an update is available,
    if so then update = true.

    If update Then
    removeUpdater 'this removes the module updater
    importUpdater 'this imports the new updater
    runUpdates 'this is to run the code for updating the workbook
    End If

    End Sub

    The problem is that Excel seems to have stored the blank sub runUpdates to
    memory and then executing this instead of the new runUpdates.
    So now, if I run checkUpdates again, it thinks it already updated. Also, if
    another new version is released and I run checkUpdates again, it will now run
    the code from the previous update, not the new update.

    I hope some of this makes sense.

    Please Help. Thanks,

    R

  2. #2
    Registered User
    Join Date
    08-22-2011
    Location
    Berlin
    MS-Off Ver
    Excel 2010
    Posts
    51

    Re: Import module then run code not working.

    I would recommend to have a look at Multiple Code Management. I myself fiddled with this subject for very long before I got fed up and implemented a proper solution for this job.
    When you have, as you said, the code in a code module, once you transferred the code module from the source workbook to the target workbook, I cannot think of any reason why it may still perform code which no longer exists.

+ 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