+ Reply to Thread
Results 1 to 12 of 12

How to create an add-in or function

  1. #1
    Registered User
    Join Date
    10-04-2013
    Location
    Salt Lake City
    MS-Off Ver
    2010
    Posts
    84

    How to create an add-in or function

    I’ve looked, and I am not sure I completely understand; I’m new to VBA.
    I can’t remember how to create an add-in – which I drop into the program-files so the new function is always available.
    I may be explaining this completely stupid, I apologize – I have a =ConcatenateRange function I want to add-in to excel, so when I pull a new workbook up, the same function is there, and I don’t need to ALT+F11 to add it each time.. I know I can create a file and add it – but I am not sure.
    Anyone assist me?

    Function ConcatenateRange(ByVal cell_range As range, _
    Optional ByVal seperator As String) As String

    Dim cell As range
    Dim newString As String
    Dim cellArray As Variant
    Dim i As Long, j As Long

    cellArray = cell_range.Value

    For i = 1 To UBound(cellArray, 1)
    For j = 1 To UBound(cellArray, 2)
    If Len(cellArray(i, j)) <> 0 Then
    newString = newString & (seperator & cellArray(i, j))
    End If
    Next
    Next

    If Len(newString) <> 0 Then
    newString = Right$(newString, (Len(newString) - Len(seperator)))
    End If

    ConcatenateRange = newString

    End Function

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: How to create an add-in or function

    Add the code in Personal.xlsm file.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    10-04-2013
    Location
    Salt Lake City
    MS-Off Ver
    2010
    Posts
    84

    Re: How to create an add-in or function

    I've added the code, but still does not work when I pull up a new workbook..

    What am I missing?

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: How to create an add-in or function

    If the code resides in personal.xlsm you must write =Personal.xlsm!ConcatenateRange() when you use the function. If the code resides in an add-in you do not need the file name.

  5. #5
    Registered User
    Join Date
    10-04-2013
    Location
    Salt Lake City
    MS-Off Ver
    2010
    Posts
    84

    Re: How to create an add-in or function

    I'll try making it an add-in

    =Personal.xlsm!ConcatenateRange() does not work either
    Last edited by BenCrockett; 10-16-2013 at 11:30 AM.

  6. #6
    Registered User
    Join Date
    10-04-2013
    Location
    Salt Lake City
    MS-Off Ver
    2010
    Posts
    84

    Re: How to create an add-in or function

    Here's the file.
    Attached Files Attached Files

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

    Re: How to create an add-in or function

    When I've created add-ins, it has been as simple as:
    File -> Save as -> in file type field below name field, select "microsoft Excel add-in .xlam" and put the add-in where you can find it. Microsoft seems to default to an add-ins folder somewhere under your user name -- this can be a convenient place to store add-ins. Or store it wherever works for you.
    Then, under Excel options, find the add-ins manager dialog. If your add-in is not included in the list, select browse, find your addin, and close the dialog. http://office.microsoft.com/en-us/ex...315.aspx?CTT=1
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  8. #8
    Registered User
    Join Date
    10-04-2013
    Location
    Salt Lake City
    MS-Off Ver
    2010
    Posts
    84

    Re: How to create an add-in or function

    Thanks -- I've done that - now shouldn't I just be able to type =ConcatenateRange? I don't know what I am doing wrong.. but nothing seems to work, I've added the code in the personal.xlsm file, in the Xlstart folder too.. I'm lost at this point..

  9. #9
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: How to create an add-in or function

    There is not a ConcatenateRange routine in the workbook you have posted?

  10. #10
    Registered User
    Join Date
    10-04-2013
    Location
    Salt Lake City
    MS-Off Ver
    2010
    Posts
    84

    Re: How to create an add-in or function

    I went here C:\Program Files (x86)\Microsoft Office\Office14\XLSTART opened PERSONAL.xlsm file, and I see the ConcatenRange function...
    Attached Files Attached Files

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

    Re: How to create an add-in or function

    When I view the attached file, I see one module containing 4 sub procedures and 0 function procedures. Nothing named "concatenaterange" or similar. Make sure the add-in file you are creating is the one that contains the UDF you want to use.

    My VBA coding is almost exclusively UDF's that I store in add-ins, and the procedure I describe above is how I create the add-in. Once the add-in is created and installed, as you indicate, I simply type =myfunctionaname(arg1,arg2,) to use the function.

    It seems that I've had trouble with file names if I have both a workbook and an add-in with the same file name (in this example, are you naming the add-in personal.xlam?). Make sure the add-in has a different filename from your personal.xlsx or other workbooks that you will be working with.
    Last edited by MrShorty; 10-16-2013 at 12:59 PM.

  12. #12
    Registered User
    Join Date
    10-04-2013
    Location
    Salt Lake City
    MS-Off Ver
    2010
    Posts
    84

    Re: How to create an add-in or function

    So, there was a PERSONAL file in the AppData, and XLSTART and it wasn't trying to pull from both - I have no idea why.. the file in the AppData didn't have the function. So, I removed the file from the AppData, and now it works.. this was my resolution.. unsure how this happened..

+ 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. Improve this function and create a similar function
    By lesoies in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-01-2013, 08:23 AM
  2. [SOLVED] Create function with a function name as a variable
    By Yonni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2012, 02:08 PM
  3. Average Function-how I would create an Avergae function?
    By Max_Current in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-07-2007, 04:21 PM
  4. Macro Function:create a new function
    By Tomas in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-09-2006, 07:55 AM
  5. How do I create a function into function list?
    By Hossein Farhani in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2005, 02:07 PM

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