|
5.2. Create .NET ComponentsIf 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. Note: You can use .NET components from any VBA application. There are no version restrictions and no prerequisites other than the .NET Framework. 5.2.1. How to do itTo create a .NET component for use in Excel:
For example, the NetForExcel project (NetForExcel.sln) includes a simple class that provides a single method, which displays a message passed in as an argument: ' .NET code. Public Class NetObject Public Sub Test(ByVal arg As String) MsgBox(arg) End Sub End Class Figure 5-3. The COM class code template contains the basic elements you need for a component5.2.2. What about...The next section shows you how to use this sample .NET component from within Excel. |
|