In our ActiveX examples,
we revisited some of the functionality we??™d already built directly in Excel using VBA. The
first example .NET project will duplicate some of the functionality from our previous VBA
projects, but you??™ll see how the .NET versions require absolutely no code on the Excel client
workbook. Our second example will show how to create a custom task pane in an Excel 2007
Add-in project in conjunction with the .NET version of an Excel UserForm.
nCaution If you do not have Visual Studio 2005, you can still run the sample workbooks as long as you
have placed the Northwind 2007.accdb file in the same path that the sample code refers to. The only
other prerequisite is that the .NET Framework 2.0 must be installed on your PC.
Retrieving Data Using .NET
In this example, we??™ll reach out to the Northwind 2007 database and populate a worksheet
with data from the Employees table. The end result will look a lot like one of our early data
access samples in Chapter 2, where we imported data from the Northwind database and then
resized the columns using the AutoFit command. We will create a data access component and
then use it from within our add-in.
1. Open Visual Studio 2005, and the start page will appear.
2. In the Recent Projects area (shown in Figure 9-9) in the Create section, click the Project
link to open the New Project dialog box (shown previously in Figure 9-8).
Figure 9-9. Recent Projects section of Visual Studio 2005 start page
CHAPTER 9 n ACTIVEX AND .
Pages:
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303