tags:

views:

86

answers:

2

I am struggling to find a straight forward guide to creating office addins using VSTO and VB.net.

Specifically I would like to know how to be able to create a addin/ dll which can either be referenced from VBA in the form:-

Addin.method(argument) or Addin.property = X

Or which would install its own custom toolbars/ ribbon interface to an aspect of office for example Word.

I've checked MSDN and in terms of legibility and usability of the explanations I have drawn a blank so far.

I currently have a requirement to create at least one addin for Office 2000 to run and manipluate SQL and then a suite of addins for a customized Office 2007 (Word) set-up.

A: 

Adding global named items to the script engine from VBA code requires the script engine expose itself via IActiveScript::AddNamedItem. I doin't think Microsoft would do it anytime soon as this could break existing VBA code.

Sheng Jiang 蒋晟
Perhpas I have been a little muddy in my question.I use many references to third party dlls within VBA; with our CRM system I and can both create and manipulate CRM contact objects through VBA.For example:Activebookmark.range.text = oContact.Addresses(1).FormattedAddressWith oContact being an instance of a contact within the CRM system (though I have paraphrased a little).My quesiton is how can I achive the same functionality within a'home grown' com addin?For example:strResult = oSQLQuery.RunQuery(strQuery,strField)Where the SQL code is wrapped in a com addin?
Stuart
If you have control over the VBA code, you can declare global variables to store a reference to the addin. You may want to reconsider your design as global variables are usually considered bad practice precisely because of their non-locality: a global variable can potentially be modified without notice and creates mutual dependencies and complexity
Sheng Jiang 蒋晟
A: 

Got this working :-)

Using a class libary project and ComInterface / ClassInterface.

Stuart