+ Reply to Thread
Results 1 to 3 of 3

Auto Install VBA Code for Excel

  1. #1
    Registered User
    Join Date
    02-28-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Auto Install VBA Code for Excel

    I wrote some VBA code in Excel. I then saved it as an add-in. When I re-opened Excel, and went to the Add-in manager I found that I had to check the box beside it to make it load.

    Since I will be writing and distributing Apps written in C# that collaborate with the VBA code in Excel, it would be very useful if that code could be installed and enabled for loading without any manual intervention after the Add-in is placed in its folder. How might this be done?

    I assume there is folder for the Add-In where it will be loaded for each user on the machine and each new Excel workbook and each existing workbook. What folder is the proper one for say Excel 2003?

    BTW: The Apps and the VBA code will be installed on one machine and nothing will require a network. Assume there are no security restrictions for running the code. The code is event driven and not accessed by the user.

    I have seen this done by a text-to-speech converter that installed some time ago. After installing the App, I looked at the Add-Ins with the add-In manager and there was one with its checkbox already checked. Furthermore, for every user and every workbook, that VBA was loaded and ready to use. How was that done.
    Last edited by louarnold; 03-01-2011 at 12:30 AM.

  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: Auto Install VBA Code for Excel

    Hello louarnold,

    Welcome to the Forum!

    I am not sure about the first question. As for the second question, the first macro will retrieve the full directory path for the user's Application Data folder. Since each user has their own Add-In folder to store user created Add-Ins, the second macro uses the first and additional static folders to retrieve the full path.
    Please Login or Register  to view this content.


    Adding the Macro
    1. Copy the macro above pressing the keys CTRL+C
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.

    To Run the Macro...
    To run the macro from Excel, open the workbook, and press ALT+F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.
    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
    Registered User
    Join Date
    02-28-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Auto Install VBA Code for Excel

    @Leith Ross.
    Frankly, you are way off base.
    1. The first question is paramount. If you don't understand that, the second question is not possible to answer.
    2. Your second answer misses the entire point - read the question again.

+ 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