ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   C# COM in Excel: Avoid using Marshal (https://www.excelbanter.com/excel-programming/385964-c-com-excel-avoid-using-marshal.html)

Torben Laursen[_3_]

C# COM in Excel: Avoid using Marshal
 
I often get a "Operation unavailable (Exception from HRESULT: 0x800401E3
(MK_E_UNAVAILABLE))"
Error in Excel when I try to call my UDF in a save sheet.

If I waite a few seconds the error goes away and everything works fine.

The error comes from this line of code:
App = (MSExcel.Application)Marshal.GetActiveObject("Exce l.Application");

Where App is defined as

private MSExcel.Application App;

I read that I get a reference to Excel in the OnConnection function inside
the Connect class.

But how do I use that reference inside my UDF's?

Torben










All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com