+ Reply to Thread
Results 1 to 5 of 5

How to export/import VBA code from one workbook to another?

  1. #1
    Registered User
    Join Date
    03-20-2017
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    11

    Question How to export/import VBA code from one workbook to another?

    I've been working on some VBA code in a sample spreadsheet. I have 4 command buttons on a new sheet, 4 user forms, and 4 modules. Rather than than manually copy/paste between 2 workbooks, how can I easily export the code from one workbook to another?

    Manually copying and pasting now would not be that big of a deal. However, if I ever have to modify the code, I will have likely forgotten a lot of how VBA works, so I need a mostly automated process.

    I found Chip Pearson's article about doing that sort of thing, but it's more like a textbook than a usable process or procedure.

    Is there a built in function, or some easy way to do this? Ideally, I would like for this process to be accomplishable by a nonprogrammer techie person.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: How to export/import VBA code from one workbook to another?

    Right click on a module in the VBA Project explorer window, and select Export File to export the module

    Right click on an object or module in the VBA Project explorer window, and select Import File to import a module.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Registered User
    Join Date
    03-20-2017
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    11

    Re: How to export/import VBA code from one workbook to another?

    So, what you're telling me is that there is no way to export them all at once. Seems strange that even if there isn't a built in function, there's not code or an addon to do the job all at once.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,221

    Re: How to export/import VBA code from one workbook to another?

    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Registered User
    Join Date
    03-20-2017
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    11

    Re: How to export/import VBA code from one workbook to another?

    I didn't see Sintek's reply until I came here to update the thread. I will try those and see if they work.

    However, I also found something else and wanted to see if anyone had worked with this solution. Chip Pearson published an Import/Export module. I am able to export all the files fine. However, the import part is not working properly. I have used both of his install spreadsheets, ran Excel as an administrator while running both spreadsheets, enabled the "Trust access to the VBA project model", and am still unable to use the multi-import function. I see it in the menu, but clicking on it does nothing. I have called Chip (he has his number posted on his website), as well as sent some emails. I have not heard back in a week. It looks like this module was made a while ago, so I'm not sure it will work with Excel 2016. Has anyone gotten these to work?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Export Name Manager from one excel workbook and import to another
    By davisfs2007 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-27-2016, 12:06 AM
  2. 'Multiple Code Module Management' (Export, Import, CleanUp, etc.)
    By Warbe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-08-2015, 06:17 PM
  3. Export/ Retrieve specific data from multiple workbooks and Import into Master workbook
    By SerenitynWisdom in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-29-2013, 10:41 PM
  4. Modify exiting Macro Export data from multiple workbooks and Import into 1 Master workbook
    By SerenitynWisdom in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2013, 11:55 PM
  5. Help write code to Import/Export worksheets
    By emptycucumber in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-03-2009, 10:54 AM
  6. Macro for Export/Import - need help revising a code
    By emptycucumber in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2009, 01:27 PM

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