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

tell me exact differenceb bw qtp and selenium?(could not tell open soure and licennce? difference in usage and technical difference?

0 Answers  


How can you quit from Action.

2 Answers  


Explain roles and responsibilites of 2yrs Automation qtp engineer.

3 Answers   Oracle,


if i have 10 actions and out of 10 actions last 3 actions i renamed will my script exicute sucesfuly r not? changed actions where i can see?

1 Answers   IBM, Infosys,


how to identify an object which is not in the object repository identification can be done using descriptive programming.

2 Answers  






What is debugging? How you debug your script?

0 Answers  


To which environments does a QTP support?

1 Answers   Crea,


Why we are selecting QTP for testing ?

20 Answers   HP,


what is command for executing files?

0 Answers   VSoft,


How can you Open a Notepad and How can you write the test Resuts in Notepad by Using QTP?

3 Answers  


how to load vbs file to qtp through scripting. plz provide the code.....

2 Answers   IBM,


what is the diffrence bw qtp architectute and qtp framework?

0 Answers  


Categories