To test the function under the Visual Studio debugger, follow the steps in the following sections.
Note: If you are already familiar with debugging Excel add-ins under Visual Studio, jump to the next chapter.
If the Debug build is not currently selected, then use Visual Studio's Build - Configuration Manager... menu option and select the Debug configuration, as shown below:
Then press the Shift+Ctrl+B key combination (or use the Build - Build Solution menu option) to build the project.
Press F5 (or use the Start - Debug menu option) to start Excel.
You may be shown a dialog informing you that you cannot debug Excel.
That's fine; we just want to debug our add-in. Check the box marked "Don't show this dialog again" and click on Yes to continue. That should be last time we see that dialog.
Depending on your security settings, a security dialog may appear.
If it appears, click on "Enable this add-in for this session only" or "Enable Macros".
Tip: This security dialog can get very tedious very quickly. See Security settings for instructions on how to prevent it during development.
If the dialogs above did no appear, or if your functions don't appear in Excel, then it's worth checking your security settings at this point: if your macro security level is set to "High", then you will not be able to test your add-in, since Excel will not allow you to open any XLL.
In Excel 2007, click on the Office Button, and then on the button "Excel Options", which appears at the bottom of the menu.
In the "Excel Options" window, select "Trust Center" from the list on the left, and then click the "Trust Center Settings..." button.
In the "Trust Center" window, select "Macro Settings" from the list on the left, and set the "Macro Settings" level to either of: "Disable all macros with notification" or "Enable all macros (...)".
(Note: While the second choice, "Enable all macros (...)" is very convenient to use, it is not safe unless your computer is running on a safe network, or you never open spreadsheets from external sources.)
In Excel 2003 or Excel XP, use the "Tools/Options..." menu command to display the "Options" window.
In the "Options" window, select the "Security" tab, and then click the "Macro Security..." button.
In the "Security" window, select the "Security Level" tab, and set the level to either "Medium" or "Low".
(Note: While the "Low" setting is very convenient to use, it is not safe unless your computer is running on a safe network, or you never open spreadsheets from external sources.)