11 thoughts on “Copying VBAproject components

  1. Thanks Jan! I usually open both files and drag and drop in the VBE. This will make things a little easier.

  2. JK, the download link on your site doesn’t seem to be working.

    What’s the advantage in using the tool compared to plain old drag-and-drop in the VB Project window?

  3. The main advantage is that it detects object modules (TWB and sheet) and copies their content entirely.
    Note that it copies by the name of the worksheet TAB, NOT by the code name.

    I’ll fix the link. Thanks.

  4. J-Walk…..
    Practical application….I work in an office where I’ve developed a rather elaborate (IMHO) timesheet for 9 different people. Every once in a while I make some enhancements to it. To keep track of what I’ve done and rewrite it (or drag and drop) to each of the other 8 is a pain. I’ve copied/modified some of Chip’s code to delete and overwrite the VBA code from one timesheet to another but it doesn’t always work as expected.

    Jan Karel….
    Great idea and could be very useful but doesn’t work in my application (for the same reason that I can’t get Chip’s code to work 100% of the time).
    An option to delete (overwrite) a module in the target that already exists in the source would be a definite bonus.

  5. John –

    Put all the code into an add-in. It’s easier to update an entire file than to try to update portions of code, especially with Office 2002’s introduction of security constraints revolving around permission to access the VB project via code.

  6. Has anyone else used the VBACodeCompare by formulasoft. It is free! (I am easy to please) and really quite slick. Bad news is it doesn’t seem to have been updated for 2007 yet.

    I really rate it. It is very helpful for telling where your versions diverged, particularly in these copy scenarios.

    Althought there is a basic flaw in that it should be able to spot identically matching module names and highlight them so that you don’t need to check each one by hand. (It is more flexible in that it can compare any two objects).

    I wrote my own but it isn’t anywhere near this good.

    Hope this is useful to someone.

  7. However, i think tracktime record nicely about what had already happen (past), it would be nice if the software can suggest/ hint the future base on what one have done in the past, e. g. if i had use iphoto for long period of time on last monday, there will be a popup or some kind of reminder, suggesting that i should use iphoto again on monday, that way, one will always have things to do….

  8. Could you modify your code to allow selecting a list of workbooks so that code could be copied from a source file and to all workbooks selected to be opened? I’d find this useful as a updater tool to multiple workbooks.


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.