views:

170

answers:

2

Hi,

How do I know which methods are available in my XLL module, in case i need to use / call any of them in my VBA code.

I can do this by calling the:

Application.Run()

method, in which I have to pass my macro-name as the parameter.

My question is about this macro-name: how do I know which macros are present in my XLL addin.

Any help is appreciated.

Cheers!!!!!!!!!!! Tushar

A: 

Are you asking this from a code P.O.V? If you just want to check it out manually you can see that in the project explorer. Otherwise, I'd suggest just attempting to run the macro, but use an error handler in case the macro doesn't exist.

On Error GoTo badMacroCall
application.run(myMacro)

badMacroCall:
msgbox("That macro could not be run!")
JakeTheSnake
+1  A: 

You can use the Application.RegisteredFunctions method to give you a list of the functions in the XLLs that Excel has registered.

For example, the following code will list the XLL, the function name and the parameter types for the XLLs that are currently registered:

Public Sub ListRegisteredXLLFunctions()
    Dim RegisteredFunctions As Variant
    Dim i As Integer

    RegisteredFunctions = Application.RegisteredFunctions


    If IsNull(RegisteredFunctions) Then
        Exit Sub
    Else
        Dim rng As Range
        Set rng = Range("A1")
        Set rng = rng.Resize(UBound(RegisteredFunctions, 1), UBound(RegisteredFunctions, 2))
        rng.Value = RegisteredFunctions
    End If
End Sub
Chris Spicer