CreateObject Methods


We often create automation objects and assign the object returned by CreateObject to an object variable. Once the object is created we access properties and methods of the new object using the object variable. There are times that we don't know what are the objects that can be accessed using the CreateObject method. 


Though there is no list which can tell us all the objects that can be accessed as it depends on the COM Objects with IDispatch interface registered on your computer. To find available objects, the simplest way is to look at the HKEY_CLASSES_ROOT hive in the registry: Here is a list that might help as a quick reference:

Syntax: CreateObject(Class) here a class would be Servername.typename
Servername would be the application providing the object and typename would be the type or the class of the object created.


Set objEmail = CreateObject( "CDO.Message" )
Set objIE = CreateObject( "InternetExplorer.Application" )
Set objInet = CreateObject( "InetCtls.Inet.1" )
Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
Set objExcel = CreateObject( "Excel.Application" )
Set objOutlook = CreateObject( "Outlook.Application" )
Set objPpt = CreateObject( "PowerPoint.Application" )
Set objWord = CreateObject( "Word.Application" )
Set objCal = CreateObject( "MSCAL.Calendar" )
Set objQPro = CreateObject( "QuattroPro.PerfectScript" )
Set objWP = CreateObject( "WordPerfect.PerfectScript" )
Set objConn = CreateObject( "ADODB.Connection" )
Set objRecSet = CreateObject( "ADODB.Recordset" )
Set objDic = CreateObject( "Scripting.Dictionary" )
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
Set wshNetwork = CreateObject( "WScript.Network" )
Set wshShell = CreateObject( "WScript.Shell" )
Set objRandom = CreateObject( "System.Random" )
Set objArrList = CreateObject( "System.Collections.ArrayList" )
Set objSortList = CreateObject( "System.Collections.SortedList" )
Set xmlDoc = CreateObject( "Microsoft.XmlDom" )
Set xml2Doc = CreateObject( "Msxml2.DOMDocument.5.0" )
Set objiTunes = CreateObject( "iTunes.Application" )
Set objPlayer = CreateObject( "WMPlayer.OCX" )
Set objWMPlayer = CreateObject( "WMPlayer.OCX.7" )
Set objReal = CreateObject( "rmocx.RealPlayer G2 Control.1" )
Set objFSDialog = CreateObject( "SAFRCFileDlg.FileSave" )
Set objFODialog = CreateObject( "SAFRCFileDlg.FileOpen" )
Set objDialog = CreateObject( "UserAccounts.CommonDialog" )
Set SOAPClient = CreateObject( "MSSOAP.SOAPClient" )
Set objWOL = CreateObject( "UltraWOL.ctlUltraWOL" )
Set objSearcher = CreateObject( "Microsoft.Update.Searcher" )
Set objShell = CreateObject( "Shell.Application" )
Set objDeviceReplay=CreateObject("Mercury.DeviceReplay")

Comments

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?