1

I have a .Net class library and have done all things needed to include it in excel. (expoting as COM visible, for com-interop and regasm'ing the dll as well) I use excel 2007. In the excel addins, I see my 'TestLib.Functions' as checked. I am able to access the function in my VBA code as :

Set lib = New TestLib.Functions
returnVal = lib.Add(5);

This works fine.

For other code review reasons, I also saw some functions from another library accessed using the RUN method as :

Run("avSomeFunction", paramvalue)

Now, in the VBA editor, if I try to access the 'Add' function in the same way,

Run("Add", 5)

I get an error saying 'Cannot find a macro with name Add'. Is it neccesary that I should add tlb as a reference once again in the VB editot-tools-references again, apart from doing Regasm for the .net dll? Can someone please let me know what is the problem here.

p.s : for some very crazy reason, I just had this working once suddenly but again failed to work there after. very weird:(

1
  • please see the answer and the thread mentioned in the below answer for a more close answer to this. Commented Sep 1, 2011 at 8:32

2 Answers 2

0

Althought your question is not very straight-forward, I think that the links below will assist you in getting the solution to your problem.

First, I found a forum post explaining the same type of error you explain, "Cannot find Macro".

Second, if that doesn't work try researching using the links provided below:

If this does not solve your problem, please edit your question to include additional information.

Sign up to request clarification or add additional context in comments.

Comments

0

Difference between : adding a tlb as reference to invoke function VS using 'Run'? has the answer to this. Basically, I was missing the reference to the tlb in the VBA project. Apart from registering the dll, the tlb also needs to be added as a reference.

1 Comment

marking this as answer as this thread has more information related to the same question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.