VSTO & .NET & Excel

December 26, 2007

Excel 2003 & Windows Vista bug?

Filed under: .NET & Excel, COM Add-ins, VSTO & Excel — Dennis M Wallentin @ 9:56 pm

Introduction
After the release of .NET Co Library I immediately received some inputs indicating that the add-in does not work with Excel 2003 on Windows Vista. For some unknown reasons, at least for me, this configuration was not tested before I released the add-in. (It was tested on Windows Vista where Office 2003 and Office 2007 coexisted but not Office 2003 alone on Windows Vista.)

Initially I thought it was related to the add-in itself and how it added the main menu item to the standard toolbar in the VB Editor. But when I made some additional debugging and tests it turned out to be related to Excel 2003 when running it on Windows Vista. 

The case 
I set up the following vmWare configuration:

  • Windows Vista Business
  • Office 2003 Professional Edition & Service Pack 3
  • Visual Studio 2008 

I made sure that the security settings in Excel 2003 were correct as the following image shows:

security-settings-excel-2003.png 

It does not exist any activated add-ins at all. Next I created a small Windows Form project with VB and made sure that all references to Excel existed as the following image shows:

references-excel-2003.png
 

In the final step I wrote the following simple code in a Button Click event:

code-excel-2003.png

I also created a similar small project in C# as the following image shows: 

error-automation-c_.png


Programmatic access to Visual Basic Project is not trusted
When the above code was executed it showed the first message correctly while it generated the following error message when trying to access the VBE’s toolbar:

automation-excel-2003.png

A bug?
When running Excel 2003 & SP-3 on Windows XP Professional it works as expected. (It also works as expected when Office 2003 and Office 2007 coexist on Windows Vista. I’m aware of that this configuration is not recommended and is not supported.)

The only scenario I can raise this error is when using Excel 2003 on Windows Vista. I have also tested to turn off the UAC but with any success, i e the error still appears. The same error is raised when running a Shared add-in with the above code. It is also applicable to Add-in Express .NET solutions as well. As for VSTO I have not tested it.

For me it is important to know if this is related to some setting I have overlooked or if it is a bug.

If anyone can shed some light over it please let me know.

Kind regards,
Dennis

December 3, 2007

.NET Co Library is released!

Filed under: .NET & Excel, Tools — Dennis M Wallentin @ 12:06 pm

Introduction

I have finished the work with .NET Co Library so now it’s officially released. It has been an interesting project in many ways. To work with the VBE’s object model has been a challenge and I’m looking forward to the day when it has been replaced.

I hope that this tool can be a valuable tool in the daily work for developing VBA solutions in Excel. To my knowledge it’s a unique tool in that it does not exist any similar add-in.

Acknowledgement

I would like to thank Ken (Puls) and Ross (Mclean) for their help to test it and also for their contributions to improve the UI. I’m part of a mixed developer group which is named the “Group”. The “Group” major contribution was simple to raise the question “Why”.

The following is a summary about .NET Co Library:

.NET Co Library can be used with

  • Microsoft Excel 2000 and later
  • Microsoft Windows 2000 and later
  • .NET Framework 2.0 and later.

What .NET Co Library is

.NET Co Library is a free managed COM add-in for Microsoft Excel. The acronym Co in its name refers to both Connection and Code. 

With the tool you can: 

  • Store created VBA code, code snippets / procedures / modules, and SQL Queries in a well organized way enabling you to easily reuse the code in all kind of Excel VBA solutions.

  • Create connection strings to a various number of databases with two wizards, the .NET Wizard and the Data Link Wizard. Store the created connections strings in a structural way enabling you to easily reuse the connection strings in all kind of Excel VBA solutions. 

.NET Co Library has been designed so it also can be shared within a group of VBA developers over a network.

Requirements, known issues and installation

Before installing .NET Co Library it is important that you explicit read the following sections in the help file:

  • Requirements

  • Known issues

  • Installation

The help file can be downloaded as a separate file (see below). 

The NET Co Library.zip file contains two files, the setup.exe file and the NET Co Library.msi file. Installing .NET Co Library on any Windows Vista version should be done with the setup.exe file.

The tool is available “as is” but XL-Dennis providing a free support for .NET Co Library and welcome any input to improve it.

To download the help file and installation package please see: Download XL-Dennis Tools

Note: There exist some improvements in the final version compared what I have been blogposting about so therefore please read the help file.
 
Kind regards,
Dennis

Create a free website or blog at WordPress.com.