User`s guide
C Utility Library
Parameters.
Argument Type Description
pApp Object
A valid reference to
the current Excel
application
Return Value. None.
Remarks. This function must be called once for each session of Excel that
uses Excel Builder components. An error is generated if a method call is
made to a member class of any Excel Builder component, and the library has
not been initialized.
Example. This Visual Basic sample initializes the
MWComUtil library with
the current instance of Excel. A global variable of type
Object named MCLUtil
holds an instance of the MWUtil class, and another global variable of type
Boolean named bModuleInitialized stores the status of the initialization
process. The private subroutine
InitModule() creates an instance of the
MWComUtil classandcallstheMWInitApplication method with an argument
of
Application. Once this function succeeds, all subse quent calls exit without
recreating the object.
Dim MCLUtil As Object
Dim bModuleInitialized As Boolean
Private Sub InitModule()
If Not bModuleInitialized Then
On Error GoTo Handle_Error
If MCLUtil Is Nothing Then
Set MCLUtil = CreateObject("MWComUtil.MWUtil")
End If
Call MCLUtil.MWInitApplication(Application)
bModuleInitialized = True
Exit Sub
Handle_Error:
bModuleInitialized = False
End If
End Sub
C-4