Archive for the ‘VSTO Issues’ Category

Visual Studio 2008 and SQL Server 2008 Express – needs SP1

August 27, 2009

Need to up install SP1 for VS 2008 to get support for SQL Server 2008

Also, if using the web download tool from Microsoft, it may install the 64bit version (a problem if
you use 32bit os!!). In which case, and error message of: Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly,
appears. To work around this problem, uninstall the 64-bit version of SQL Server Express 2008, and then install the 32-bit version of SQL Server Express 2008
(great advice from the kb on this this article

Ambiguity using Worksheet Activate

August 26, 2009

Activate is both a method and an event of Application.Excel, so the Activate keyword must be cast to either an event or method.

Examples (based on a VSTO Excel 2007 Add-in):

Method

Excel.Workbook workbook = Globals.ThisAddIn.Application.ActiveWorkbook;
Excel.Worksheet worksheet = workbook.Sheets["Sheet2"] as Excel.Worksheet;
//The next line will throw a warning
//worksheet.Activate(); 
//Need to cast as a method
((Excel._Worksheet)worksheet).Activate(); 
//or 
((Microsoft.Office.Interop.Excel._Worksheet)worksheet).Activate() ;

Event

((Excel.DocEvents_Event)worksheet).Activate += 
                new Microsoft.Office.Interop.Excel.DocEvents_ActivateEventHandler(
                    Worksheet_Activate);

VSTO Design-Time Adaptor error

August 17, 2009

When working with VSTO and creating a new Excel 2007 Workbook project, I got an error that the VSTO Design-Time Adaptor for Excel 2007 was corrupt or unavailable. Just before repairing the install, as is advised, I had a quick check of the Task Manager, and noticed that an Excel.exe process was still running. Ended this process, and hey presto, it fixed the problem.

It appears that sometimes when debugging/running your project, if it fails or stops before the Excel app gets closed by your code, the design time adaptor hangs. This happened to me because an Automation Excetuable had left an instance of Excel up and running in visible = false mode.


Follow

Get every new post delivered to your Inbox.