3.How to record a word doc using qtp i.e open a word
doc,type something and save the doc can someone send me the
code.

Answers were Sorted based on User's Feedback



3.How to record a word doc using qtp i.e open a word doc,type something and save the doc can someo..

Answer / feroz

Dim objWord
Dim wrdDoc
set objword = CreateObject("Word.Application")
objword.visible = true
Set wrdDoc = objword.Documents.Add
wrdDoc.Range.InsertBefore "Hi Good Morning!"
wrdDoc.SaveAs "C:\Greetings.doc"
objword.quit
Set objword = nothing

Is This Answer Correct ?    5 Yes 0 No

3.How to record a word doc using qtp i.e open a word doc,type something and save the doc can someo..

Answer / ashish wadhwa

'For Excel

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True


'Adding the workbook
Set objWorkbook = objExcel.Workbooks.Add

'Adding the text in the workbook in 1st row and 1st Column
objExcel.Cells(1, 1).Value = "Hi This is me Ashish"

'Saving the excel file
objWorkbook.SaveAs("D:\Sample.xls")

Is This Answer Correct ?    3 Yes 0 No

3.How to record a word doc using qtp i.e open a word doc,type something and save the doc can someo..

Answer / ashish wadhwa

'For TextFile

'Creating a file system object
Dim objFSO

'Creating a text file object
Dim objTextFile

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("D:\SampleFile.txt"
,True)

objTextFile.Write("Sample Automation Example of saving text
file"

objTextFile.Close

Is This Answer Correct ?    2 Yes 0 No

3.How to record a word doc using qtp i.e open a word doc,type something and save the doc can someo..

Answer / nani

wt abt for text file and excel files?

Is This Answer Correct ?    1 Yes 1 No

3.How to record a word doc using qtp i.e open a word doc,type something and save the doc can someo..

Answer / jagdish

'For Excel

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True


'Adding the workbook
Set objWorkbook = objExcel.Workbooks.Add

'Adding the text in the workbook in 1st row and 1st Column
objExcel.Cells(1, 1).Value = "Hi This is me Ashish"

'Saving the excel file
objWorkbook.SaveAs("D:\Sample.xls")

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

Hi Friends... By using QTP , can we test .net products...and that product supports different languages.. thanx in advance..

1 Answers  


Hi every body, I am new to QTP.pls help me if anybody knows the solution. Here is my doubt: I have 3 excel sheets in my local drive out of which one is password protected and i want to get the data of all these xL's either by importing or by reading the data finally i have to update this data in the website.(and the site is secured site) I tried by importing all XL"s one by one but couldn't do so. plss send me the code or atleast suggest me the approach. Thanks in Advance Padmaja

3 Answers   Symphony,


Hi Guys, I am very new to QTP tool , In real time environment how to test the application with this tool, 1. How to load application in QTP tool 2. How to write test script in QTP. 3. In manual testing we test login box (user id , password) how can we test this kind of testing with QTP tool with examples . Please guys put some focus on my questions , real time ecperienced answers would be appreciate, advance thanks ,please guys i am expecting ur answers as soon as posible

1 Answers   IBM, INCA,


Once we get the Test Result from QTP.,I Have to convert into Excel file format..Is it possible..Can any gudie me regarding this... For Example : Total Test Case is : XXXXX Test Case passed : XXX Test Case Failed : XXX -------- Total XXXXXX ---------

6 Answers  


How to supress warnings from the "Test results page"?

6 Answers   BirlaSoft,






IF there are seven browsers with same name open. I want to close one particular browser thru QTP. how can i do this?

3 Answers   Polaris,


In QTP how to interact tool and application build?

2 Answers  


How to add synchronisation points in qtp?

0 Answers  


Explain types of descriptive programming?

0 Answers  


Recovery Manager means..?

4 Answers  


What are the differences between quicktest professional and winrunner?

0 Answers  


What expansion of "MIC" in MICPASS (TEST ReportPAGE)

11 Answers   TCS,


Categories