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

What is the use of ordinal identifier in qtp?

0 Answers  


how could i download qtp in which i get add-in support for 'oracle' is there any way to get it? i finding but not getting pls help me out :)

0 Answers  


On what document base Descriptive programming is written if build is not yet ready ?

0 Answers  


Once the Actions are splitted , is there any way to merge them

3 Answers  


what r the verstions from 1st to present (verstions) of mercury tools (like winrunner,QTP,Loadrunner) ? Chandana

0 Answers   Mannar Company, Wipro,






Hi Sudhananda, plz send me the QTP framework with any diagram and PPTS . I want to switch to automatio, I done QTP from professional person, but he does not give me his knowledge properly. so pls help me Thaks send me on following address mirajkar.akash@gmail.com

0 Answers   TechSoft,


What is the difference between the keyword view and expert view?

0 Answers  


Hi, Plz give best Definition of Software Testing? Why we need Software Testing? and plz send 2+yrs experience Interview qutions (Manual,Qtp).

1 Answers  


wht type of User defined functions or Java Releated functions do we write in VB scripting

0 Answers   Wipro,


Hi, I will provide perticular age,it needs to enter date in text box (MM/DD/YYYY) compare to system date. or already exist data in the text box.

2 Answers   Virtusa,


Does QTP run in any environment?

0 Answers  


How to create a run time propertyfor an object?

3 Answers   IBM,


Categories