Accessing the underlying OLE data
I am creating an AddIn for Excel 2002+ using C# 2005.
I can access the OLEObject within Excel using interop but I dont know how can I access the data inside it ("Native"). I tried using OLEObject::Copy() and then using OleOpenClipboard() to get IDataObject pointer and it worked. But I don;t want to use clipboard during this operation this is what I did : ///////////////////////////////////////////////////////////////////////////*///////////////////////////////////////////////////////////////////////////*///////////// Guid guidDataObject = new Guid("0000010E-0000-0000- C000-000000000046"); // Guid for IDataObject IntPtr pUnknown = Marshal.GetIUnknownForObject(oleObject); IntPtr pDataObject = IntPtr.Zero; int hr = Marshal.QueryInterface(pUnknown, ref guidDataObject, out pDataObject); ///////////////////////////////////////////////////////////////////////////*///////////////////////////////////////////////////////////////////////////*///////////// But the HRESULT says "Specified cast is not valid" I also tried using OleRun() before QueryInterface(...), but it didnt work. thanks |
All times are GMT +1. The time now is 05:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com