Object Module
Group
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 - It can optionally contain Attributes one of which must be VB_Name.
See Also: Attribute Definition/Statement, Class Module, Code Module, Uses.
Example
'MyCommands macro
'#Uses "Sample.OBM"
Sub Main
Debug.Print Sample.Name
End Sub
'Sample.OBM object file
VERSION 1.0 OBJECT
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sample"
Option Explicit
Public Function Name() As String
Name = "Sample Object Module"
End Function