http://quicktesthp.blogspot.com

QTP VBScript new series + Interview Question Bank on QTP for enrichment of Knowledge in QTP

This Site has been brought to you by HP Certified Expert of QTP.

Exciting new articles for October:

1) QTP Tip:Deselect all Radio Buttons

2) HP QTP Crypt Object

3)Adding Hyperlinks in Excel Spreadsheet

Best of Luck Friends ! ! !

Expert QTP
expert.qtp@gmail.com

All Articles are Copyright Protected. These are Free for Reading & Personal Use. Reproduction in Any Form without the Permission is Illegal & Strictly Prohibited.

Copyright © 2009 ExpertQTP

Google Search

Saturday, August 2, 2008

Creating MS Word document inside QTP

How many of you guys ever thought of creating a MS doc file with the help of QTP. It is in fact quite simple to create one. Let me show you a sample script of creating a very simple document in MS Word.


Dim obj_MSWord
Set obj_MSWord = CreateObject("Word.Application")
obj_MSWord.Documents.Add
obj_MSWord.Selection.TypeText "This is a simple text"
obj_MSWord.ActiveDocument.SaveAs "D:\Expert.doc"
obj_MSWord.Quit

Now you will try to copy paste this code in your QTP but due to some formatting problems you may not get the proper format. Please take care of the quotes before Word.Application. These should be double quotes else your script wont run.

Think of this scenario . Lets say I have already opened MS Word document. Now I want to save it into my PC. The script is slightly different from the one shown above.Any idea what should be the code??

1 comment:

Anonymous said...

You are doing a great job ExpertQTP but no idea regarding your assignment.

Ankit

 
Copyright © 2009 ExpertQTP