how do i get a com addin to talk to a .net form?

neuralSea

New member
Joined
Dec 16, 2003
Messages
2
Ive created a COM addin for several office applications (word,excel,ppt) and have put a commandbarbutton into each. Clicking this button calls a form.

The form acts as a user interface to the current documents document properties so that the user only need click onto menuitems in several context menu boxes, selected a couple of keywords and they are set as properties (builtin and custom) for that document.

The only problem is that I keep getting an object reference not set. I just dont know how to pass the document type detected in the com addin e.g.
if typeof (application) is word.application then
dim docType as word.document
wordApp = CType(application, word.application)
excelApp = nothing
pptApp = nothing
else if ...

to the form! The form uses oCustomProperties = docType.BuiltInDocumentProperties
etc to get anything usefule done so the addin needs to pass the docType to the form ByVal. I just dont know how to do this. Please help!

Eternally indebted,

neuralSea
 
There is ment to be an SDK or a .Net DLL in Office that allows you to write Managed add-ins for Office(For Office XP only though, I believe), you can create a second class that is exposed to COM get the COM Add-in to create this class and call ShowForm(ByVal Params As ...) then you should be able to edit it, dont ask me how to send any information back though.
 
Q: Using Office Component for Addins in .Net

I develop an Addins Project for Excel in Visual Studio.NET that I need it to work for any machine in any Microsoft Office XP.
I use the dependecy (reference) Interop.Microsoft.Office.Core(Microsoft Office 10 Component) for my project.
But it seem that its not work fine in others computers (differenct than the one I develop the project, where the addins work fine)
the Dot NET raise errors:
+ "The Dependecy Interop.Microsoft.Office.Core could not be found."
+ "The referenced component Microsoft.Office.Core could not by found. A wrapper assembly is not registered for this type library."
Q: How can I solve the errors above for others computers so the addins work for other computer?

When I start to create the Addins project the Dot NET use the reference office.dll(under .NET references).
I remove this reference because I needed the first reference(in order to use the office menus), and because those two reference cant work together(they have the same name).
Q: What is this reference? Can I use it to solve my problem? How?

How did you make sure that you wont have problem using the application in other computer (using this component)?

How did you make sure that the addins work for other computer?
 
1) You need to take the interop DLL, in .Net adding a COM dll causes VS.Net to make a .Net wrapper DLL for the COM dll. ie. MyCOM.dll[COM Component]>AxMyCOM.dll[.Net Wrapper]>MyProgram.exe
You need to take the AxMyCOM.dll with your project to get it to work, its usually found in the Bin directory
 
RE

My addins contains also setup project that install the addins. The setup project also include the Microsft Office Component Dependecy - Interop.Microsoft.Office.Core.dll.
So I believe the setup should handle it -
Q: am I wrong about it?

notice that I use the setup to install the addins to other computer, but the addins doesnt work because of my problem.
 
If your Interop DLL is included in the setup project, is the project being implemented correctly(Registered by the installer)?
 
re: com addin

I eventually used: Implements Extensibility.IDTExtensibility2 with a couple of additions. The VS.NET professional does do a com addin which would have been great knowing about it before I starting registering everything via the command-line using what I gained through an exceptional book on .NET and COM interop.
 
Back
Top