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

How can i get the image text that changes dynamically? Here i have used "GetROProperty", but it's not working. I used like Ex:Browser("webmail").Page("inbox").image ("captchaimage).getroproperty("innertext/text/value")

0 Answers  


Explain the check points in QTP?

2 Answers  


What is log file? what is the use of Log fine. How to create? what are the contents and the main advantages of log files. plz do help me in this concepts as i have an interivew on qtp in a couple of days. plz do help me.. thanks in Advance.

1 Answers  


What is the difference between a Test and a Business Component? Is it necessary to use Business Component while testing an application in the real time?

2 Answers  


Explain the check points in quicktest professional?

0 Answers  






can i change the runtime properties of an object ? How can i check if a parameter exists in database ?

0 Answers  


Can we add the function library directly from scripting in qtp instead of adding from resource tab?

5 Answers   IBM,


What is Description Object?

1 Answers  


I would like to do some certifications in QTP. please suggese what kind of certifications can i do. I am currently put up at chennai. So please suggest some reputed centres where these courses are offered.

1 Answers  


How to change the screen name while running the test.

3 Answers   TCS,


What is test automation framework?which framework does QTP follow?Need some practical explanation as to how u will start ur testing process following a particular framework?

2 Answers   IBM, Sony,


You have an application version 1 with 5 combo boxes, Developers develop version 2. Here they replaced bottom 3 combo boxes with each other. While executing the Test script for version1 no errors. When we execute the Test script for version2 that QTP showing the error message "Object not identified" remember no property changed in version 2, ordinal identifier also disabled. Find what properties might change here in this scenario

6 Answers   ADP,


Categories