Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Got already an XLA (cmb1.xla) that handles a single commandbar. Within this XLA I've got various functions that I would like to make generic use of from other XLA's, so that I only have to maintain the code in one XLA (similar to a DLL really).

    AO. functions are:
    • NewToolbar_Add
    • NewToolbar_Position
    • cmbPopUp_Add
    • cmbMenuPoint_Add
    • cmbButton_Add


    Instead of including these in one more XLA (cmb2.xla), I would like to reference the ones already exisitng in cmb1.

    Can this easily be done??


    THX
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    RDO,

    You can add a reference to the XLA or call it this way
    application.Run "OtherWorkbookName.xla!Macro1"

    I know this works with .xls files but don't know if it will transfer to
    .xla's.

    RG
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RubberDuckOne View Post
    ..... I've got various functions that I would like to make generic use of from other XLA's, so that I only have to maintain the code in one XLA (similar to a DLL really).....
    It's been a while since I've looked at this, but Steve Roman's book has a fully worked example of using a free-standing Utility item. (In the book, it's Print utilities.) The reference to the Utilities item - which cannot be loaded directly - is compiled into an Add-in. It then has to be in the Add-ins folder to keep the functions available.

    HTH
    Gre

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RubberDuckOne View Post
    ..... I've got various functions that I would like to make generic use of from other XLA's, so that I only have to maintain the code in one XLA (similar to a DLL really).....
    It's been a while since I've looked at this, but Steve Roman's book has a fully worked example of using a free-standing Utility item. (In the book, it's Print utilities.) The reference to the Utilities item - which cannot be loaded directly - is compiled into an Add-in. It then has to be in the Add-ins folder to keep the functions available.

    HTH
    Gre

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RubberDuckOne View Post
    ..... I've got various functions that I would like to make generic use of from other XLA's, so that I only have to maintain the code in one XLA (similar to a DLL really).....
    It's been a while since I've looked at this, but Steve Roman's book has a fully worked example of using a free-standing Utility item. (In the book, it's Print utilities.) The reference to the Utilities item - which cannot be loaded directly - is compiled into an Add-in. It then has to be in the Add-ins folder to keep the functions available.

    HTH
    Gre

  6. #6
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RubberDuckOne View Post
    ..... I've got various functions that I would like to make generic use of from other XLA's, so that I only have to maintain the code in one XLA (similar to a DLL really).....
    It's been a while since I've looked at this, but Steve Roman's book has a fully worked example of using a free-standing Utility item. (In the book, it's Print utilities.) The reference to the Utilities item - which cannot be loaded directly - is compiled into an Add-in. It then has to be in the Add-ins folder to keep the functions available.

    HTH
    Gre

  7. #7
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RubberDuckOne View Post
    ..... I've got various functions that I would like to make generic use of from other XLA's, so that I only have to maintain the code in one XLA (similar to a DLL really).....
    It's been a while since I've looked at this, but Steve Roman's book has a fully worked example of using a free-standing Utility item. (In the book, it's Print utilities.) The reference to the Utilities item - which cannot be loaded directly - is compiled into an Add-in. It then has to be in the Add-ins folder to keep the functions available.

    HTH
    Gre

  8. #8
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RubberDuckOne View Post
    ..... I've got various functions that I would like to make generic use of from other XLA's, so that I only have to maintain the code in one XLA (similar to a DLL really).....
    It's been a while since I've looked at this, but Steve Roman's book has a fully worked example of using a free-standing Utility item. (In the book, it's Print utilities.) The reference to the Utilities item - which cannot be loaded directly - is compiled into an Add-in. It then has to be in the Add-ins folder to keep the functions available.

    HTH
    Gre

  9. #9
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RubberDuckOne View Post
    ..... I've got various functions that I would like to make generic use of from other XLA's, so that I only have to maintain the code in one XLA (similar to a DLL really).....
    It's been a while since I've looked at this, but Steve Roman's book has a fully worked example of using a free-standing Utility item. (In the book, it's Print utilities.) The reference to the Utilities item - which cannot be loaded directly - is compiled into an Add-in. It then has to be in the Add-ins folder to keep the functions available.

    HTH
    Gre

  10. #10
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RubberDuckOne View Post
    ..... I've got various functions that I would like to make generic use of from other XLA's, so that I only have to maintain the code in one XLA (similar to a DLL really).....
    It's been a while since I've looked at this, but Steve Roman's book has a fully worked example of using a free-standing Utility item. (In the book, it's Print utilities.) The reference to the Utilities item - which cannot be loaded directly - is compiled into an Add-in. It then has to be in the Add-ins folder to keep the functions available.

    HTH
    Gre

  11. #11
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RetiredGeek View Post
    RDO,

    You can add a reference to the XLA or call it this way
    application.Run "OtherWorkbookName.xla!Macro1"

    I know this works with .xls files but don't know if it will transfer to
    .xla's.

    RG
    Thanks RG.

    But from tests so far and based on the documentation, I don't think this method will work. From below extract from the documentation .run only passes parameters as values.

    "Remarks
    You cannot use named arguments with this method. Arguments must be passed by position.

    The Run method returns whatever the called macro returns. Objects passed as arguments to the macro are converted to values (by applying the Value property to the object). This means that you cannot pass objects to macros by using the Run method."



    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  12. #12
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RetiredGeek View Post
    RDO,

    You can add a reference to the XLA or call it this way
    application.Run "OtherWorkbookName.xla!Macro1"

    I know this works with .xls files but don't know if it will transfer to
    .xla's.

    RG
    Thanks RG.

    But from tests so far and based on the documentation, I don't think this method will work. From below extract from the documentation .run only passes parameters as values.

    "Remarks
    You cannot use named arguments with this method. Arguments must be passed by position.

    The Run method returns whatever the called macro returns. Objects passed as arguments to the macro are converted to values (by applying the Value property to the object). This means that you cannot pass objects to macros by using the Run method."



    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  13. #13
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RetiredGeek View Post
    RDO,

    You can add a reference to the XLA or call it this way
    application.Run "OtherWorkbookName.xla!Macro1"

    I know this works with .xls files but don't know if it will transfer to
    .xla's.

    RG
    Thanks RG.

    But from tests so far and based on the documentation, I don't think this method will work. From below extract from the documentation .run only passes parameters as values.

    "Remarks
    You cannot use named arguments with this method. Arguments must be passed by position.

    The Run method returns whatever the called macro returns. Objects passed as arguments to the macro are converted to values (by applying the Value property to the object). This means that you cannot pass objects to macros by using the Run method."



    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  14. #14
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RetiredGeek View Post
    RDO,

    You can add a reference to the XLA or call it this way
    application.Run "OtherWorkbookName.xla!Macro1"

    I know this works with .xls files but don't know if it will transfer to
    .xla's.

    RG
    Thanks RG.

    But from tests so far and based on the documentation, I don't think this method will work. From below extract from the documentation .run only passes parameters as values.

    "Remarks
    You cannot use named arguments with this method. Arguments must be passed by position.

    The Run method returns whatever the called macro returns. Objects passed as arguments to the macro are converted to values (by applying the Value property to the object). This means that you cannot pass objects to macros by using the Run method."



    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  15. #15
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RetiredGeek View Post
    RDO,

    You can add a reference to the XLA or call it this way
    application.Run "OtherWorkbookName.xla!Macro1"

    I know this works with .xls files but don't know if it will transfer to
    .xla's.

    RG
    Thanks RG.

    But from tests so far and based on the documentation, I don't think this method will work. From below extract from the documentation .run only passes parameters as values.

    "Remarks
    You cannot use named arguments with this method. Arguments must be passed by position.

    The Run method returns whatever the called macro returns. Objects passed as arguments to the macro are converted to values (by applying the Value property to the object). This means that you cannot pass objects to macros by using the Run method."



    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

Page 1 of 2 12 LastLast

Posting Permissions

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