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

Could someone explain me how to work on Out put values, explain with some example on Flight Reservation. I want to insert the out put value for the order No. Please explain the steps with some example.

2 Answers  


Tell about descriptive programing in qtp8.2?

4 Answers   GE,


It is given in the help of QTP 9.2 that we cant debug the scripts. Is there any other way to VIEW, PAUSE and make modifications in the scripts during execution???

0 Answers  


How to do Laod testing for web based Application?

1 Answers  


write script for how to add function library in QTP

2 Answers   Aspire,


Hi I have exp in manual testing and planning to move in automation testing qtp(9.2).So can help me how to automate customer relationship management tool using qtp and vb script this tool already developed so how can I test it whatever maintaining by development team like documents,various options just give the whole life cycle thanks in advance

0 Answers   Mphasis,


Describe the differences between functions and actions in UFT?

0 Answers  


What are the types of object repository in qtp?

0 Answers  


Hi, Where should I get all the test's results If I ran the scripts in Batch run. At the result window I found only last test result. Could any one help me on this?

3 Answers   Livetek,


Are You using any frame work? What is that? Explain about that.

4 Answers   Wipro,


Could any one suggest web site links to learning VB Script for QTP purpose??

3 Answers  


am not having intrest in coding lang like c c++ java etc can i choose Testing tools as my carrier and please suggest me which tool is good (suitable for me)

0 Answers  


Categories