Calling an Add-in from a macro

A

Ajoy Raj

hi,

I've got an add-in (Managed COM Add-in) which runs as a simple
toolbar. The public method is MyProjectAddin.Show()

Also, I have a macro that needs to call this Add-in to execute
commands on it. How do I go about it ?

I've tried out things like Application.Run("MyProjectAddin") &
MyProjectAddin.Run without any success.

Since I'm new to Office Solutions, I have no clue how to go about
it. Googling for a long time hasn't helped either.

Any help would be greatly appreciated.

_Ajoy
 
M

Mark Durrenberger

Not sure why you would "call" and add-in from a macro.

Add-ins can be set up to run from a button on a toolbar or from any number
of MS Project events, however you need to build that capability into the
add-in..

Do you have access to the add-in code?

Mark


--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 
A

Ajoy Raj

Let me explain in a little more detail.

I have a C# .NET assembly that is bundled as a Shared Add-in.

I also have a Macro that runs inside MS Project.

What I am trying to achieve is to have this Macro call different functions
inside the C# (or VB.NET) add-in and submit values into it.

I can't seem to find a way for the VBA Macro to use the add-in. I can find
the description and name of the add-in using
Application.COMAddins.Item(4).Description, but nothing more.

_Ajoy
 
M

Mark Durrenberger

I'm not sure but this matters but are the routines in the add-in "Public" -
do you know the names of any or the names of the forms (your macro could do
a formxyz.show etc...)

In otherwords, have you tried calling the routines in the addin directly?

Curious, What does the add-in do?

Mark

--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 
L

Lars Hammarberg

If you're not going to use the addin through the UI (calling code from
toolbar buttons etc.) but only for providing methods/functions for use in
other code, why not simply keep it as an "ordinary" dll and declare
references to the methods in it like this:
Private Declare Function myFunc lib "c:\thepath\TheDLL.dll"
Then simply use the myFunc function in your VBA/macro code just as if it was
any other function available to your code in VBA.

/Lars Hammarberg
www.camako.se
MSProject Premier Partner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top