Search code examples
excelvbaexcel-addins

Save Description in Member Options dialog box in Object Browser


I've created an Addin with some Functions. When I try to add the description of the functions to give screen tips it won't save.

A pic where I try to save the screen tips. Object Browser/MyLibrary/Right click the Function and select Properties
ObjectBrowser


Solution

  • there a way to make the formula arguments appear when typing the formula, as there is when a native function is invoked.

    You can make the arguments appear if the user presses Ctrl + A.

    https://wellsr.com/vba/2017/excel/vba-macrooptions-to-add-udf-description/

    Here is an example of how to register details for the user-defined function, to launch the formula wizard which will contain the tooltips.

    Sub RegisterUDF()
    Dim strFunc As String   'name of the function you want to register
    Dim strDesc As String   'description of the function itself
    Dim strArgs() As String 'description of function arguments
    
        'Register Linterp linear interpolation function
        ReDim strArgs(1 To 3) 'The upper bound is the number of arguments in your function
        strFunc = "Linterp"
        strDesc = "2D Linear Interpolation function that automatically picks which range " & _
                  "to interpolate between based on the closest KnownX value to the NewX " & _
                  "value you want to interpolate for."
        strArgs(1) = "1-dimensional range containing your known Y values."
        strArgs(2) = "1-dimensional range containing your known X values."
        strArgs(3) = "The value you want to linearly interpolate on."
        Application.MacroOptions Macro:=strFunc, _
                                 Description:=strDesc, _
                                 ArgumentDescriptions:=strArgs, _
                                 Category:="My Custom Category"
    End Sub