LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 0x800A03EC error during Application.WorkbookOpen event handler

I am building a VSTO C# add-in for Excel (Office 2003 and Office 2007)

I have an event handler for the Application.WorkbookOpen which refreshes
data in a workbook. Prior to refreshing the data I need to clear old data and
formatting. The code for this is:

Excel.Range t1 = (Excel.Range)(Globals.ThisAddIn.Application.Active Sheet as
Excel.Worksheet).Cells[query.StartRow, query.StartCol];
Excel.Range t2 = (Excel.Range)(Globals.ThisAddIn.Application.Active Sheet as
Excel.Worksheet).Cells[query.EndRow, query.EndCol];
Excel.Range range1 = Globals.ThisAddIn.Application.get_Range(t1, t2);
range1.ClearFormats();
range1.Clear();

The ClearFormats (or Clear if it is placed first) will generate an
0x800A03EC exception. Unfortunately the error message is not very helpful as
it gives no indication as to why the call failed.

The same code when called after the workbook has fully opened is working
fine. Application.Ready is true at the point that the clear functions are
called.

Any ideas as to what might be going on?

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error handler question in Worksheet_Change event Sam Kuo[_3_] Excel Programming 3 March 12th 08 08:47 PM
Worksheet_change event handler error gen Excel Discussion (Misc queries) 0 January 18th 08 04:55 AM
Creating An Application Event Handler HLong Excel Programming 3 June 30th 05 09:59 PM
Run-time error '424' in VBA event handler on XL shutdown Mike Jones Excel Programming 3 May 6th 05 07:26 PM
Application level event handler broken in 2003SP1 ? Alex T Excel Programming 3 August 29th 04 07:47 PM


All times are GMT +1. The time now is 07:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"