Using .xla file as an Add-In

  • Hello,


    I have created an .xla file with all sorts of functions that I want to use from an .xls file. The .xla file is added as an Add-In in Excel. In the .xls file I have a number of command buttons that are supposed to run the functions in the .xla file. In the "assign macro" dialog of the comman buttons I have just specified the function name of the function contained in the .xla file.


    This seems to be working fine but problems arise when I move the .xls file to another directory. For some strange reason the new path is added to the macro path in the command buttons when I do this even though the .xla file is an Add-In and already loaded. That is... First the macro is specified as "openMenu". When the .xls file is moved to another directory this is updated to: c:\myNewDirectory\myXLAFile.xla!openMenu. This causes Excel to complain about that there is already one myXLAFile.xla open so it can not open another one eventhough myXLAFile.xla is not located under c:\myNewDirectory\.


    This is driving me insane! Would really appreciate some help on this matter.


    Thank you in advance

  • Re: Using .xla file as an Add-In


    hi [MCV],



    welcome to Ozgrid.com


    To my knowledge add-in functions are used on general workbooks that is
    when you want the function simply click on the function you need.


    what you are doing is assigning macros from the add in to a workbook.
    this might be the reason Excels says there's another macro running.


    2 suggestions:


    1. configure yr add-in to yr workbook so that you can directly apply yr add-in functions to it
    2. copy yr add-in functions/macros to yr workbook mannualy.


    hope this helps

    Cheers
    ___________
    Xlite :sheep:
    [st]All you need to learn VBA is an internet connection and Ozgrid.com[/st]

  • Re: Using .xla file as an Add-In


    Thank you for the reply!



    Quote

    1. configure yr add-in to yr workbook so that you can directly apply yr add-in functions to it


    Could you please clarify how this is done? If I understand you right that is exactly what I am trying to do.


    Quote

    2. copy yr add-in functions/macros to yr workbook mannualy.


    I created the .xla file to avoid just this. My .xla file is 500kb and I do not want to copy its contents for every worksheet I create.


    Thank you!

  • Re: Using .xla file as an Add-In


    Thank you for your reply!


    That is what I have done. Please note that the problem isn't that I can not access the .xla file after I have added it as an Add-In. That part works fine. The problem is that Excel tries to open the .xla file twice when I move the .xls file using the .xla file by adding "c:\myNewDirectory\myXLAFile.xla!" before all my calls to functions contained in the .xla file. As myXLAFile.xla is already open Excel complains about this.


    What I can not figure out is why the path to my .xls file is added in the macro calls to the .xla file which is already an Add-In.


    /Thanks

  • Re: Using .xla file as an Add-In


    I think you need to go into Tools > Addins & either uncheck the addin or simply agree when you are informed that "Cannpt find xxx.xla. Remove from list/" or similar. Then browse to the new location.

  • Re: Using .xla file as an Add-In


    Quote from [MCV]

    The problem is that Excel tries to open the .xla file twice when I move the .xls file using the .xla file by adding "c:\myNewDirectory\myXLAFile.xla!" before all my calls to functions contained in the .xla file.


    Not certain if this will help any, but perhaps try adding the path of whereever the addin file is actually located to all of the places that Excel is adding "c:\myNewDirectory\myXLAFile.xla!"? Seems to me like Excel sometimes does funny things when you let it just assume where macros &/or functions are coming from.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!