Object Module

Group: Declaration

Description:
An object module implements an ActiveX Automation object.

• It has a set of Public procedures accessible from other macros and modules.

• These public symbols are accessed via the name of the object module or an object variable.

• Public Consts, Types, arrays, fixed length strings are not allowed.

• An object module is similar to a class module except that one instance is automatically created. That instance has the same name as the object module's name.

• To create additional instances use:

Dim Obj As objectname

Set Obj = New objectname

See Also: Class Module, Code Module, Uses.

Example:

'A.WWB

'#Uses "System.OBM"

Sub Main

Debug.Print Hex(System.Version)

End Sub

 

'System.OBM

'File|New Module|Object Module

'Edit|Properties|Name=System

Option Explicit

Declare Function GetVersion16 Lib "Kernel" _

Alias "GetVersion" () As Long

Declare Function GetVersion32 Lib "Kernel32" _

Alias "GetVersion" () As Long

 

Public Function Version() As Long

If Win16 Then

Version = GetVersion16

Else

Version = GetVersion32

End If

End Function