Creates an OLE Automation object.
The class argument is a string indicating the name of the application used to create the object and the type of object. To specify an object's class, use the following syntax:
The class argument has these parts:
appname The name of the application providing the object.
objecttype The type, or class, of object to create.
Each application that supports OLE Automation provides at least one type of object. For example, a word-processing application may provide an application object, a document object, and a toolbar object.
Note To get a list of OLE Automation objects an application supports, consult that application's documentation.
Use this function to create an OLE Automation object and assign the object to an object variable. To do this, first dimension a variable of type object. Then use the Set statement to assign the object returned by CreateObject to the object variable. For example:
Dim MyObject As Object
Set MyObject = CreateObject("WordProc.Document")
When this code is executed, the application creating the object is started if it is not already running (WordProc.Exe in this example), and an object of the specified type is created. Unlike creating a linked or embedded object using the OLE control, the object's image is not displayed anywhere in Visual Basic, nor is the object's data maintained by Visual Basic.
Once an object is created, you reference it in Visual Basic code using the object variable you defined. In the above example you access properties and methods of the new object using the object variable, MyObject. For example:
MyObject.Insert "Hello, world."
Chapter 23, "Programming Other Applications' Objects"