+ Reply to Thread
Results 1 to 3 of 3

Macro to install code into another workbook

  1. #1
    Registered User
    Join Date
    08-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    45

    Macro to install code into another workbook

    Hi guys,

    I have a question on how I would create a macro to install code in another workbook.

    Essentially I want to do two things: Copy (or install) a module with code into a selected workbook, and also modify an existing part of a macro in the selected workbook. The process flow would be similar to the below:
    • User is presented with a list of all open workbooks and clicks desired workbook they want to install additional code into
    • Macro automatically copies a module from the current workbook to the selected workbook
    • User is then presented with a list of all macros in the selected workbook and clicks the desired macro to install this code in.
    • Once selected, macro looks for a specific line of code in that subroutine, eg TO:, and replaces it with a predefined value.

    I am getting better at VBA, but unfortunately this is over my head. I know some of it is possible from what I've read, and would love an expert to take a look at tell me if it's possible. Any help would be much appreciated.

    Many thanks,
    fullysic

  2. #2
    Registered User
    Join Date
    08-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Macro to install code into another workbook

    Just an update on where I'm at with this -

    I've managed to create a form with a combobox that lists all open workbooks, and once the desired workbook is selected my new code module is copied into this selected workbook.

    However, I'm currently stuck with creating another form with a combobox to list all macros in this open workbook, and once the macro is selected code is inserted into this module at the top under any variable declarations.

    I'll keep working on it, but if anyone has any tips on the above please let me know.

  3. #3
    Registered User
    Join Date
    08-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Macro to install code into another workbook

    Another update:

    I've figured out how to add custom code to a module, however I am unable to ensure it is added to a specific subroutine.

    The code I'm using to add to a module is :

    Please Login or Register  to view this content.
    Now realistically, I don't want to specify the module that the sub is in, but rather supply the sub name itself and have the code inserted. Is this possible at all?

+ 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