User`s guide

4 Usage Examples
4-22
Private Sub LoadFourier()
'Initializes globals and Loads the Spectral Analysis form
Dim MainForm As frmFourier
On Error GoTo Handle_Error
Call InitApp
Set MainForm = New frmFourier
Call MainForm.Show
Exit Sub
Handle_Error:
MsgBox (Err.Description)
End Sub
Private Sub InitApp()
'Initializes classes and libraries. Executes once
'for a given session of Excel
If bInitialized Then Exit Sub
On Error GoTo Handle_Error
If theUtil Is Nothing Then
Set theUtil = New MWUtil
Call theUtil.MWInitApplication(Application)
End If
If theFourier Is Nothing Then
Set theFourier = New Fourier.Fourier
End If
If theFFTData Is Nothing Then
Set theFFTData = New MWComplex
End If
bInitialized = True
Exit Sub
Handle_Error:
MsgBox (Err.Description)
End Sub
Creating The Visual Basic Form
The next step in the integration process develops a user interface for your
add-in using the Visual Basic Editor. Follow the steps outlined here to create a
new user form and populate it with the necessary controls.
1 Right-click on the VBAProject item in the project window and select
Insert->UserForm from the pop-up menu.
2 A new form appears under Forms in the VBA Project. In the forms property
page, set the name property to
frmFourier and the Caption property to
Spectral Analysis.