Consulting

Results 1 to 6 of 6

Thread: call code in a different workbook

  1. #1
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location

    call code in a different workbook

    Can workbook_A call code in Workbook_B? If it is possible, how? Also to install an addin through code, do I just copy it to the add-in folder?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Application.Run "'another book.xls'!mySub"
    [/vba]

    Addins need to be 'registered' within Excel, which is not that straightforward. An alternative is to put it in the XLSTART directory, then it automatcally loads at startup, but here again, the startup directory could be in many places.

    This might help

    http://www.jkp-ads.com/Articles/DistributeMacro10.htm
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    xld,

    I have this and currently it does nothing. No error and it also doesn't run the code

    [VBA]Application.Run "'Business Reporting Today.xlam' addtoolbar"[/VBA]

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Check what I gave against what you have.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    the only difference I see is it is missing the !, however I tried that first and it also didn't do anything

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I haven't got 2007 on this machine, so I'll try it in the morning on my laptop.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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