This is a duplicate of a posting on Officedev so apologies to anyone who's
read this already.
I had an Office add-in built in VB.Net 2003 with an Excel and a Word add-in
class that transferred data from Excel to Word using the clipboard. It worked
well until I developed a new version using VS 2005 and VSTO (the Excel and
Word add-ins are now separate DLLs). Now I find that after placing data on
the clipboard using the Excel.Range.Copy method, this data is only visible to
the Excel add-in. Within the Word add-in, calling Clipboard.GetDataObject
returns Nothing whereas calling the same method from within the Excel add-in
returns the data.
The Excel add-in gets a reference to the Word add-in by calling
Marshal.GetActiveObject("Word.Application") and looping through the Word
application's COMAddIns collection. The Object property has been set by
overloading the RequestComAddInAutomationService function in the Word add-in
(textbook implementation) and the Excel add-in calls a method on this object.
It is this method that is tryng to retrieve the data from the clipboard.
I haven't changed the code at all in the new version (apart from what's
necessary to implement the VSTO-style add-in) so I'm guessing it's something
to do with the add-ins running in different threads. Can anyone shed some
light on this?
Thanks
Pete