+ Reply to Thread
Results 1 to 2 of 2

Remove and Import Module

  1. #1
    Richard
    Guest

    Remove and Import Module

    I need to replace a module in selected workbooks with a module having the
    same name.

    I'm using the Remove method of the VBComponents collection to remove the
    module.

    I'm also using the Import method to import a module from a *.bas file.

    The problem is:

    ....the module isn't 'removed' immediately following processing of the Remove
    method, therefore, since a module with the same name still exists,

    ....when the Import processes, the new module is given the name with a '1' at
    the end

    ....when processes ends...the 'removed' module is finally 'removed'

    Is there a way to complete the Remove prior to the Import so that the
    imported module will not have the '1' in the name?

    Thanks,

    --
    Richard

  2. #2
    Michael Beckinsale
    Guest

    Re: Remove and Import Module

    Richard,

    Pls see my post of yesterday which contains code which does exactly as you
    describe and which works fine.

    Only problem l can envisage without seeing your code is that my code is
    contained in a "control" type of workbook which is independent from the
    workbook which needs modifying. If you try and run the code in the workbook
    which needs modifying you will have problems which l believe is caused by
    the way the project is compiled.

    Chip Pearson has some great coding / tips about this on his website

    www.cpearson.com

    Regards

    Michael Beckinsale


    "Richard" <[email protected]> wrote in message
    news:[email protected]...
    >I need to replace a module in selected workbooks with a module having the
    > same name.
    >
    > I'm using the Remove method of the VBComponents collection to remove the
    > module.
    >
    > I'm also using the Import method to import a module from a *.bas file.
    >
    > The problem is:
    >
    > ...the module isn't 'removed' immediately following processing of the
    > Remove
    > method, therefore, since a module with the same name still exists,
    >
    > ...when the Import processes, the new module is given the name with a '1'
    > at
    > the end
    >
    > ...when processes ends...the 'removed' module is finally 'removed'
    >
    > Is there a way to complete the Remove prior to the Import so that the
    > imported module will not have the '1' in the name?
    >
    > Thanks,
    >
    > --
    > Richard




+ 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