• Reuse of XLA's (cross referencing functions)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Reuse of XLA's (cross referencing functions)

    Author
    Topic
    #465645

    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

    Viewing 8 reply threads
    Author
    Replies
    • #1197949

      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!
      Computer Specs

      • #1198030

        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.”

      • #1198644

        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.”

      • #1199139

        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.”

      • #1200238

        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.”

      • #1201107

        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.”

      • #1201951

        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.”

      • #1202694

        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.”

      • #1203590

        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.”

    • #1197988

      ….. 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

    • #1198596

      ….. 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

    • #1198983

      ….. 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

    • #1200190

      ….. 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

    • #1200944

      ….. 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

    • #1201903

      ….. 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

    • #1202608

      ….. 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

    • #1203529

      ….. 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

    Viewing 8 reply threads
    Reply To: Reuse of XLA's (cross referencing functions)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: