Create .NET Components
If you are an experienced VBA programmer, this is a great way to start learning .NET because you can take advantage of features built in to the .NET Framework in small, incremental steps.
You can use .NET components from any VBA application. There are no version restrictions and no prerequisites other than the .NET Framework.
How to do it
To create a .NET component for use in Excel:
From within Visual Studio .NET, create a new Class Library project using VB.NET or C#. Visual Studio creates a folder and template files for the project as shown in Figure 5-1.
Figure 5-1. A new, empty .NET class library project
From the Project menu, choose Add Class. Visual Studio displays the Add Project Item dialog box, as shown in Figure 5-2.
Figure 5-2. Create a new COM class to contain components for use from Excel
Give the new class a descriptive name and click OK. Visual Studio registers the project to interoperate with COM (the Register for COM Interop selection on the Project Options, Build dialog box) and creates a new, empty code template for your class, as shown in Figure 5-3.
Add code to the class library for the objects, properties, and methods you want to use from Excel.
Compile the project by selecting Build Solution from the Build menu. Visual Studio ...