Codematic Excel developers logo
Codematic spreadsheet-excel development image

Rapid Application Development / Advanced Excel Development

 
Products for Excel
Commercial Products:
  - Classic Ribbon
  - Alt-FileSearch
  - Password Remover
Spreadsheet Quality Products
Free Products
Excel Development
Excel Development Index
Excel VBA
- VBA IDE (editor)
- VBA Training
- VBA Best Practice
- VBA Performance
- COM Performance
- VBA Security
Excel and Databases
Excel and Pivot Tables
Excel Add-ins
Worksheet Functions
Excel and xlls
Excel (in)security
Excel testing
Excel and .net
Excel External Links
Excel Developer Types
Professional Excel Development
Excel 2007
Excel 2010
Excel Development Archive
Spreadsheet Services
Spreadsheet Development
Spreadsheet Migration
Spreadsheet Maintenance
Spreadsheet Review
Spreadsheet Management
Resources
Excel User Confs
Consultant Profile
Book Reviews
Links
Other
Site Map

Debugging Excel xlls

Whilst the xll features of Excel offer excellent functionality and superb performance, they are not for the faint hearted. Excel/VBA developers especially have trouble deciphering the documentation. Add in the need to use a different development environment and language and its easy to see why this powerful option is often rejected.

Xll Series Contents

(note this is a work in progress - more pages will be added and linked too as and when we have time to complete them to an acceptable level)

Debugging xlls

As part of the xll creation process several Visual Studio settings need to be changed so your xll will work with Excel. In summary these are:

  1. Change debug information format
  2. Change extension to xll
  3. Add xllcall32.lib dependency
  4. Set Excel as the debug host program

These are already set in the Codematic xll demo project (available from here).


1. Debug mode.

You can use VB style breakpoints in your xlls, although the change/continue features are not so rich. Sadly Excel does not understand the standard debug build xlls, so you need to modify that setting. In VS2008:

In Project>>Project Name>>properties>>Configuration Properties>>C/C++ change the 'Debug Information Format' from the default 'Program Database for Edit & Continue (/ZI)' (which adds symbols that Excel does not understand) to 'Program Database (/Zi)'

If you forget to do this you will either get an 'Unrecognisable file format' error when you try to load your xll in Excel or the even more obvious:

2. Change extension to xll

By default the type of base project to use to create an xll is a dll. VS will therefore want to add a .dll extension to the final output file. To change that to xll:
In Project>>Project Name>>properties>>Linker select Output File and change the dll to xll. You need to do this for the debug configuration and the release one (or all configurations)

3. Add xlcall32.lib dependency

To work with the Excel C API you have to tell VS how to, that information is contained in xlcall32.lib. You need to add it to the project dependencies:

In Project>>Project Name>>properties>> Linker>>Input Additional Dependencies add xlcall32.lib (you should have previously copied that file from the SDK to the lib folder).

4. Set Excel as the debug host program

Finally to make debugging easier you can set the debugger to open Excel. Unfortunately it does not load the xll, you must do that using Excel functionality (either using Tools>>Add-ins, or copying the xll to the xlstart folder).
To set the debug exe:

In Project>>Project Name>> properties>>Configuration Properties>>Debugging select Command and choose browse from the drop down. Browse to Excel.exe and click ok.

The generator tries to set this up but Visual Studio ignores it, so it must be set manually for each project. Once it has been set manually VS remembers it for the future.

 
To download the free Codematic xll demo project go here.
For details of our custom xll development service please go here.

If you require any more information please get in touch.

 

 

Upcoming Events:

25 January 2012 - UK Excel Developer Conference - London


Products for sale:

AltFileSearch

Office 2007 FileSearch replacement logo

New information about the missing FileSearch feature in Office 2007 and details of our pragmatic solution (Current price GBP 30.00)


wsUnprotector

worksheet password remover logo

Instant Excel worksheet protection remover and password recovery (Current price GBP 15.00)


Classic Ribbon Tab

classic ribbon for office 2007 logo

Add Excel 97/2000/2002/2003 compatible menu structure to Excel 2007
(Current Price GBP 10.00)


 

Products coming soon:

Link Manager

(Find and control external links in Excel Workbooks)

Due by Q1 2111.

XLAnalyst Pro

(Excel VBA based spreadsheet auditing tool)

Due before the end of 2111.

  ;-)
This page was last reviewed on December 21, 2011

©Codematic Ltd 1999-2011