2009-10-16 22 views
0

如何知道我的XLL模塊中有哪些方法可用,以防我需要在VBA代碼中使用/調用其中的任何方法。EXCEL插件中的方法 - XLL

我可以通過調用做到這一點:

Application.Run() 

方法,我要通過我的宏名作爲參數。

我的問題是關於這個宏名:我怎麼知道我的XLL插件中存在哪些宏。

任何幫助表示讚賞。

乾杯!!!!!!!!!!! Tushar

回答

3

可以使用Application.RegisteredFunctions方法給你在Excel有註冊的XLLs的功能列表。

例如,下面的代碼將列出XLL,函數名以及的參數類型爲當前註冊的XLLs:

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 
0

你是從代碼P.O.V問這個嗎?如果你只是想手動檢查出來,你可以在項目瀏覽器中看到。否則,我會建議試圖運行宏,但如果宏不存在,則使用錯誤處理程序。

On Error GoTo badMacroCall 
application.run(myMacro) 

badMacroCall: 
msgbox("That macro could not be run!")