CreateObject is function which creates a reference to the specified object. You can then use the reference object to access the methods/properties of the specified object.
As createobject returns a reference to object, you must use Set to assingn it to a variable.
Set objExcel=CreateObject(“Excel.Application”)
'Adding a workbook
Set objWorkBooj= objExcel.Workbooks.Add
'Activating the sheet
Set objSheet=objWorkBook.Worksheets("Sheet1")
'Writing values to excel
objExcel.Cells(row,column)=<”Your value>”
'Adding a workbook
Set objWorkBooj= objExcel.Workbooks.Add
'Activating the sheet
Set objSheet=objWorkBook.Worksheets("Sheet1")
'Writing values to excel
objExcel.Cells(row,column)=<”Your value>”
Below is the list of most commonly used objects. I hope you find it useful.
S.No
|
Object
|
Description
|
1
|
Set ObjectName= CreateObject("Wscript.shell")
|
Provides access to the native Windows shell. Provides functions to read system information and environment variables, to work with the registry and to manage shortcuts.
|
2
|
Set ObjectName = CreateObject("WScript.Network")
|
Provides access to the shared resources on the network to which the computer is connected.
|
3
|
Set ObjectName = Createobject("Excel.Application")
|
Perform operations on MS Excel.
|
4
|
Set ObjectName = CreateObject("Word.Application")
|
Perform operations on MS Word.
|
5
|
Set ObjectName = CreateObject("Outlook.Application")
|
Perform operations on MS Outlook.
|
6
|
Set ObjectName = CreateObject("InternetExplorer.Application")
|
Perform operations on Internet Explorer.
|
7
|
Set ObjectName = Createobject("QuickTest.Application")
|
Perform operations on Quick Test Professional (QTP).
|
8
|
Set ObjectName = CreateObject("QuickTest.UpdateRunOptions")
|
A collection of properties that indicate preferences for the Update Run in QTP.
|
9
|
Set ObjectName = CreateObject("QuickTest.RunResultsOptions")
|
A collection of properties that indicate preferences for the run results in QTP.
|
10
|
Set ObjectName = CreateObject("Scripting.FileSystemObject")
|
To work with the Windows file system structure: files, folders, drives.
|
11
|
Set ObjectName = CreateObject("Mercury.DeviceReplay")
|
Perform mouse or key operations exactly as they occur on the mouse or keyboard drivers.
|
12
|
Set ObjectName = CreateObject("Mercury.ObjectRepositoryUtil")
|
Perform an operation on QTP Object Repository.
|
13
|
Set ObjectName=CreateObjcet("Scripting.Dictionary")
|
Creates a dictionary object
|
14
|
Set ObjectName=CreateObject("vbScript.RegExp")
|
Creates a regular expression object
|
15
|
Set ObjectName = CreateObject("Mercury.FileCompare")
|
To compare two files.
|
14
|
Set ObjectName = CreateObject("Mercury.Clipboard")
|
Perform clipboard functionality.
|
15
|
Set ObjectName = CreateObject("Msxml2.DOMDocument")
|
Creates a DOMDocument object to perform operations related to XML document.
|
16
|
Set ObjectName = DotNetFactory.CreateInstance (TypeName [,Assembly] [,args])
|
Returns a COM interface for a .NET object.
|
17
|
Set ObjectName = Createobject("shell.application")
|
To instantiate the Shell object, to program the Shell which can be used to access the file system, to launch programs, and to change system settings.
|
18
|
Set ObjectName= Createobject("TDApiOle80.TDConnection.1")
|
An object that enables to manage the Quality Center connection and retrieve the TDOTA object, which provides full interaction with Quality Center.
|
19
|
Set ObjectName = CreateObject("Microsoft.XMLDOM")
|
To access and manipulate XML documents via the XML DOM implementation, as exposed by the Microsoft XML Parser.
|
20
|
Set ObjectName = XMLUtil.CreateXML()
|
Creates and returns an object of type XMLData. If a root name is specified, a new document is created containing the specified root tag.
|
21
|
Set ObjectName = CreateObject( "AcroExch.App")
|
Acrobat OLE Automation Objects.
|
Set ObjectName = CreateObject( "AcroExch.AVDoc")
| ||
Set ObjectName = CreateObject( "AcroExch.PDDoc")
| ||
Set ObjectName = CreateObject( "AcroExch.HiliteList")
| ||
Set ObjectName = CreateObject( "AcroExch.PDBookmark")
| ||
Set ObjectName = CreateObject( "AcroExch.Rect")
| ||
22
|
Set ObjectName = CreateObject("ADODB.Connection")
|
Creates an instance of the ADO connection to connect to database.
|
23
|
Set ObjectName = CreateObject("ADODB.Recordset")
|
Creates an instance of the recordset object. To be able to read database data, the data must first be loaded into a recordset.
|
24
|
Set ObjectName =CreateObject("msscriptcontrol.scriptcontrol")
|
Perform operations to MS Windows Scripting Engine.
|
25
|
Set ObjectName = CreateObject("SAPI.SpVoice")
|
Auditory voice feedback during a test run, done by utilizing the Microsoft Speech API.
|
26
|
Set ObjectName = CreateObject( "UserAccounts.CommonDialog")
|
Object to provide users with a standard File Open dialog box
|
27
|
Set ObjectName = CreateObject("CDO.Message")
|
Windows CDO object is suitable for creating and sending automated emails.
|