Explain the keyword createobject with an example.

Showing Answers 1 - 30 of 30 Answers

Venkat Potluri

  • Jul 28th, 2005
 

Creates and returns a reference to an Automation object 
syntax: CreateObject(servername.typename [, location]) 
Arguments 
servername:Required. The name of the application providing the object.  
typename : Required. The type or class of the object to create.  
location : Optional. The name of the network server where the object is to be created.  

Prasad

  • Aug 2nd, 2005
 

create object creates handle to the instance of the specified object so that we program can use the methods on the specified object. It is used for implementing Automation(as defined by microsoft). 
 
ex: set oDesc= createobject(Excel.application) 
odesc.activeworksheet=1 

  Was this answer useful?  Yes

suchitra

  • Sep 30th, 2005
 

Createobject:Creates and returns a reference to an Automation object.
Example:
Dim ExcelSheet
Set ExcelSheet = CreateObject("Excel.Sheet")

  Was this answer useful?  Yes

atul

  • Oct 17th, 2006
 

Hi Venkat,

If u can help me in giving ans of below questions ...

1.How can i create exe file for QTP script?

2.how can i send qtp script result in mail using QTP script method???

I m very thankful to u if u can solve my problem its very urgent...

  Was this answer useful?  Yes

Asif

  • Dec 20th, 2006
 

You need to create an object of type CDO or CDONTS for that purpose

  Was this answer useful?  Yes

meetsubhas

  • Apr 9th, 2007
 

Hi atul , this is subhasis

Here is ur answers of ur questions

1.u can create an excel sheet by writing this script

   datatable.addsheet "sheet name"

2. u can send ur result by writing this script

  datatable.exportsheet"full path with sheet name where u have to save",source id

ex:- datatable.exportsheet"d:atul.xls",3

source id:-
  1 for global sheet
  2 for action1 sheet
  3 for that sheet which u have to create

regards....

  Was this answer useful?  Yes

tseshasayi

  • Jul 18th, 2007
 

Dim any file
set object name = create object"object file .exetesion"
file name .run"object requiredand opath of that object"
set file name=nothing

  Was this answer useful?  Yes

Hi Guys,

     Createobject method use to create COM object.

 
Generally we use this method for reading, writing data from notepad file or .xls files.

if any queries:

  nanda.dreddy@gmail.com

  Was this answer useful?  Yes

Create Object is a keyword related to Automation Object model.
Automation Object Model is a concept provided to automate the operations to be performed on QTP through scripting.

Example

Dim qtpapp
Dim qtptest
set qtpapp=create object("Quicktest.Application")
qtpapp.launch
qtpapp.visible=true
qtpapp.open "path of a test",true

set qtptest=qtpapp.test
qtptest.run
qtptest.close

qtpapp.quit


The above script will create an object for the Quicktest Proffesional application.
It will automatically launch the QTP, opens a test (as per the path mentioned), runs the test, closes the test and finally closes the QTP application also.

All the above actions can be performed only by executing the script without any manual operations.

This is the help of Create Object keyword.

  Was this answer useful?  Yes

SanthanCh

  • Nov 22nd, 2008
 

CreateObject means, it creates the object for particular application.

Example:

Set objex = CreateObject("Excel.Application")

Here, we are creating an object for an Excel Application. The Object name is "objex"

  Was this answer useful?  Yes

kiranpaul20

  • Jun 16th, 2010
 

CreateObject creats an object to interact with the specified library

For Ex
If we want to interact with internet explorer to launch IE then we use create object and the library name.

Set IE = CreateObject("InternetExplorer.Application")
IE.visible = True
IE.Navigate http://www.google.com

Here IE is an object which is created to interact with the Internet Explorer Library.

Like wise for any library

Set xlapp = CreateObject("Excel.Application")
Set QTapp = CreateObject("QuickTest.Application")


Kiran Paul

  Was this answer useful?  Yes

amulc

  • May 9th, 2011
 

CreateObject: Creates and returns a reference to an Automation object.

Using CreateObject function QTP interacts with external application Object such as Msword,Excel,FilesystemObject etc.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions