Consulting

Results 1 to 5 of 5

Thread: Including or Referencing a Module from other Workbooks

  1. #1
    VBAX Regular
    Joined
    May 2009
    Location
    Johannesburg
    Posts
    69
    Location

    Including or Referencing a Module from other Workbooks

    Good Day All!

    I have had a lot of good luck with you experts, so I am going to take another shot here:

    I can't seem to "reference..." an extra Module I wrote. This particular module is indeed accessible through other modules within the same active worksheet, through the object.method approach. I simply wrote a group of functions which I found myself rewriting time and time again. Now I have them available in a centralised location (like an #include file). How do I easily reference this module?

    I was also interested in finding out whether or not I could develop a DLL in Delphi (my strong suit IDE) which I could then somehow include/reference from several separate VBA Projects. Is calling exterrnal DLL functions possible in VBA?

    Thanks!
    Deyken
    DeezineTek
    South Africa

  2. #2
    VBAX Expert JP2112's Avatar
    Joined
    Oct 2008
    Location
    Astoria, NY
    Posts
    590
    Location
    I believe the syntax is

    Workbookname!Module.Function

    With 'Module' being optional if the function name is unique.

    Note that if you set a reference to the workbook (using Tools > References in the VB IDE) you don't need to qualify the function name with the Workbook name.

    Also, you could put those common functions into a separate workbook, save the workbook as an add-in and install it, and you could use them that way (also without qualifying them with the workbook name).

    As for your question about DLLs and Delphi, I'm afraid that's beyond me.

  3. #3
    VBAX Regular
    Joined
    May 2009
    Location
    Johannesburg
    Posts
    69
    Location
    Hi JP2112,

    Thanks a lot. Could I use the "Save As..." function in Excel to save a workbook as an add-in? How do I go about installing it?

    Look forward to your reply!
    Deyken
    DeezineTek
    South Africa

  4. #4
    VBAX Expert JP2112's Avatar
    Joined
    Oct 2008
    Location
    Astoria, NY
    Posts
    590
    Location
    For information on creating Excel add-ins, see http://www.fontstuff.com/vba/vbatut03.htm

    To install an add-in, see http://www.bettersolutions.com/excel...D023821888.htm

  5. #5
    VBAX Regular
    Joined
    May 2009
    Location
    Johannesburg
    Posts
    69
    Location
    Thanx, bud!
    Deyken
    DeezineTek
    South Africa

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •