+ Reply to Thread
Results 1 to 5 of 5

Programmatically export the VBA code from an Excel workbook

  1. #1
    Registered User
    Join Date
    07-13-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    1

    Lightbulb Programmatically export the VBA code from an Excel workbook

    Hi all,

    I would like to programmatically export all the VBA code from an Excel file.
    Preferably java, but any language will do.

    I want to end up with a plain text file with all the code. This is what you get when you exprt the code from the VB Editor, but I want to do it automatically.

    I also don't want to have to edit the VBA code in the original Excel file.

    Thanks in advance

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Programmatically export the VBA code from an Excel workbook

    Hello Daryn,

    Welcome to the Forum!

    I don't know of a way to export the data from a VBA project without using the VB Editor or inserting a macro into the VBA project to export the code. The other problem is the export feature creates individual files. It does not have an option to export into a single text file.

    This basically leaves you with the option of having to use a macro. While a macro can export the code into a single text file, you run into problems if there are UserForms in the project. UserForm files have 2 parts the .frm file holds the code. The hidden file .frx holds binary information used to draw the form. The .frx file type is proprietary and exists with the Excel workbook. Unfortunately, this file is only accessible using the export feature of VBA.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Programmatically export the VBA code from an Excel workbook

    I have an addin that exports all the code modules, forms etc to a folder. You can then use this to import the code to another workbook.

    I'll check it out & see about finishing it
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Programmatically export the VBA code from an Excel workbook

    Please Login or Register  to view this content.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Programmatically export the VBA code from an Excel workbook

    This addin will Export all Code & Forms to a selected Directory,Import Code from a selected directory, delete all code from a selected workbook. Also shows a customised Toolbar to select FaceIds & store favourite Ids

    When the addin is installed it will add a new menu item - Code Tools
    Attached Files Attached Files
    Last edited by royUK; 07-14-2010 at 01:12 AM. Reason: attachment

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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