+ Reply to Thread
Results 1 to 9 of 9

Cannot use my own function stored in myAddins.xlam

  1. #1
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    Cannot use my own function stored in myAddins.xlam

    I developed a function and stored this in an Excel-Addin File named "myAddins.xlam" together with a macro (sub) that I have developed before. The Macro is visible as Macro in the settings menu for ribbons and can then be executed. But I cannot use the function in my Visual Basic Editor, the compiler says "Sub or Function not defined".

    Any ideas ?


    2019-02-08_20-50-09.jpg


    2019-02-08_20-51-29.jpg


    2019-02-08_20-53-45.jpg

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Cannot use my own function stored in myAddins.xlam

    I think this sounds like a case where you are neglecting to set a reference to the add-in containing the function. I have only encountered this rarely, so I am not very knowledgeable, but something like this should explain: http://www.cpearson.com/excel/References.htm
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    Re: Cannot use my own function stored in myAddins.xlam

    Hello MrShorty

    Maybe it doesn't look the same in Windows and Mac, but it is the same as cpearson references in his description:

    2019-02-08_20-50-09.jpg

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Cannot use my own function stored in myAddins.xlam

    What are the two () doing after the String in GetArray Function?
    Attached Images Attached Images
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  5. #5
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    Re: Cannot use my own function stored in myAddins.xlam

    Hmm ... I am not good enough to teach others, but it works in this way.
    As I understand the () marks it as an one-dimensional array of strings.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Cannot use my own function stored in myAddins.xlam

    I always use a variant and never used this.
    One way or other there is something missing then or is the parameter that you pass of another type then the dimensionned type?

  7. #7
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    Re: Cannot use my own function stored in myAddins.xlam

    Hello Keebellah

    Ok, I can explain what this function is for, but in general the function works and is not the problem. Stored directly in my project, the function works as expected. Therefore I would like to go back to my question, except you think that the definition of the return value has something to do with the compile problem ...

  8. #8
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    Re: Cannot use my own function stored in myAddins.xlam

    @MrShorty: This was really close ! But it could not solve my problem immediately. I was searching around and have found a better better description:

    https://www.fontstuff.com/vba/vbatut08.htm

    if you create a .xlam, then you have to reference this twice
    • One time within the workbook that is using this .xlam you will find in the menu "Development Tools" the button "Excel-Add-Ins". If you activate this check box, the .xlam will be visible in your VBA Editor and you can also find your Macros (Sub) listed in the Macros Menu for Execution.
    • To use the functions inside the .xlam you have also to register the .xlam project in the VBA-Editor. There you will find your .xlam listed in the Project Browser. Click on this and give it first a better name (e.g. myAddins instead of VBAProject). Then select in the Project Browser your current project in that you want to use the functions from your .xlam and click in the VBA-Editor Toolbar to Tools -> References. Now you have a dialog box with all the external libraries and you will find your myAddins project. Click the checkbox there and your functions can be used as normal functions in your current project.

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Cannot use my own function stored in myAddins.xlam

    You can also add the code to open the xlam on workbookopen event.
    Don't forgte to close the xlam workbook beforeclose event

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How-to use function stored in another workbook
    By BuddJ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-07-2018, 09:39 AM
  2. match function not finding integers stored as text
    By filterengineeer in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-22-2017, 08:12 AM
  3. [SOLVED] custom function stored in xla file on XLstart not available
    By a.hudrea in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-15-2014, 08:25 AM
  4. Return Stored function in Access from Excel
    By jrdnoland in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2014, 04:16 AM
  5. Call a function in another Excel 2010 AddIn (.xlam)
    By exaveal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-10-2013, 05:36 PM
  6. Copy Image Stored in XLAM to Active Worksheet
    By stanbridge in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-24-2009, 12:35 AM
  7. calling oracle stored function with CLOB parameter
    By Jlorga in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-03-2006, 07:58 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1