Automation and VSTO working together

L

Luis Simões

Hi,
I have an automation dll for the functions in excel and a VSTO dll to
control de events, commandbars and some more specific options like
adding/removing connections to databases( connection strings - simulate MS
Query for pivot tables) (My first tought and try was to use the formulas in
the VSTO but since it doesnt work i have separated the classes into
automation and vsto)

Now i have a problem...
Since one of the VSTO options is to setup some connections strings and open
a connection with that conn string, i wanted to use that already opened
connection in the functions at the automation addin. Something like
"function1(arg1)" will use the already open connection and return a value
from the database corresponding to arg1.

The problem is that the automation addin dont know the open connection and i
can't seem to find a way to specify it.

This is a little bit confusing but i hope you guys can manage ;)

This is really important for me.

Best Regards,
Luis Simões
 
J

Jens Thiel

Your "vsto" and "automation" classes run in separate AppDomains - you have
to use remoting to communicate between them.

Jens.
 
L

Luis Simões

Hi Jens Thiel thx for the response.

How can i manage that? Can i use the same App Domain? I don't understand
that too much. ;/

Best Regards,
Luis Simões
 
J

Jens Thiel

Luis,

you can not use the same AppDomain: an automation add-in is a single
instance shared between all workbooks, while VSTO requires a separate
AppDomain for each workbook. You will need to use Remoting or re-think your
design.

Jens.
 
L

Luis Simões

ok. What is the best solution to have commandbars, forms and formulas for all
workbooks in excel? I needed to create an application to manage database
connections and get data to cells trought formulas requests.

Best Regards,
Luis Simoes
 

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