PC Review


Reply
Thread Tools Rate Thread

C# COM in Excel: Avoid using Marshal

 
 
Torben Laursen
Guest
Posts: n/a
 
      23rd Mar 2007
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("Excel.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








 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to avoid Compatibility Checker MsgBox? VBA to avoid or prevent? EagleOne@discussions.microsoft.com Microsoft Excel Programming 1 16th Jan 2009 08:54 PM
how to avoid excel pop-up in macro Francesco Magagnino Microsoft Excel Misc 3 8th Sep 2008 11:30 AM
Marshal.AllocHGlobal versus Marshal.AllocCoTaskMem REVISISTED Hypnotron Microsoft VB .NET 0 12th Dec 2004 10:16 PM
Marshal.AllocHGlobal versus Marshal.AllocCoTaskMem Hypnotron Microsoft VB .NET 2 11th Dec 2004 03:18 AM
Use of Marshal.FreeCoTaskMem after Marshal.PtrToStructure Ken Allen Microsoft C# .NET 1 14th Apr 2004 10:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:27 AM.