Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Capture the objects in a word document

This is a discussion on Capture the objects in a word document within the QTP forums, part of the Software Testing category; Please answer my question. Is it possible to capture the objects in a word document for QTP. If so please give me the code.Thanx....

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 04-10-2007
Junior Member
 
Join Date: Feb 2007
Location: India
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
prasadgali is on a distinguished road
Capture the objects in a word document

Please answer my question.
Is it possible to capture the objects in a word document for QTP. If so please give me the code.Thanx.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-10-2007
Expert Member
 
Join Date: Nov 2006
Location: Hyd-IND
Posts: 528
Thanks: 1
Thanked 63 Times in 50 Posts
sutnarcha is on a distinguished road
Re: Capture the objects in a word document

Try applying Learn option on MSWord, it will store all the details of the objects in MSWord in the object repo.

I recorded some actions in MSWord, here is the code

Window("Microsoft Word").Activate
Window("Microsoft Word").WinObject("Menu Bar").Click 24,9
Window("Microsoft Word").Window("File").Click 23,14
Window("Microsoft Word").Window("New").WinButton("OK").Click
Window("Microsoft Word_2").Activate
Window("Microsoft Word_2").WinObject("_WwG").Type "This is the way to do it."
Window("Microsoft Word_2").WinObject("Menu Bar").Click 27,14
Window("Microsoft Word_2").Window("File").Click 46,78
Window("Microsoft Word_2").Window("Save As").WinObject("way").Type "way"
Window("Microsoft Word_2").Window("Save As").Click 534,325
Window("Microsoft Word_3").WinObject("Menu Bar").Click 23,16
Window("Microsoft Word_3").Window("File").Click 22,48
Window("Microsoft Word").Activate
Window("Microsoft Word").WinObject("Menu Bar").Click 21,10
Window("Microsoft Word").Window("File").Click 35,31
Window("Microsoft Word").Window("Open").WinObject("OpenListView").Click 23,58
Window("Microsoft Word").Window("Open").Click 543,321
__________________
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.

-sutnarcha-
Reply With Quote
  #3 (permalink)  
Old 04-10-2007
Contributing Member
 
Join Date: Feb 2007
Location: Madras
Posts: 72
Thanks: 11
Thanked 7 Times in 7 Posts
raghav.kamal is on a distinguished road
Re: Capture the objects in a word document

See if you are using the same code again in another ,this is not going to work coz the Coordinates are not the same again for the statements ".Click .."
So i have a script to retrienve data from excel..try changing it & retrieve from word
ex:
Dim excelobj, count
count = 1
Set excelobj = createobject("Excel.Application")
Set x =excelobj.workbooks.open("C:\default.xls")
Set y = excelobj.Activeworkbook.worksheets("sheet2")
While not isempty(excelobj.cells(Count,1))
d=excelobj.cells(counter,1),value
msgbox(d)
count=count+1
Wend
Reply With Quote
  #4 (permalink)  
Old 04-10-2007
Expert Member
 
Join Date: Nov 2006
Location: Hyd-IND
Posts: 528
Thanks: 1
Thanked 63 Times in 50 Posts
sutnarcha is on a distinguished road
Re: Capture the objects in a word document

Yes, I know that the co-ordinated may not match for other users of my code. Its just the sample code that I have shown. The best way is to record ourself.
__________________
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.

-sutnarcha-
Reply With Quote
  #5 (permalink)  
Old 04-10-2007
Contributing Member
 
Join Date: Feb 2007
Location: Madras
Posts: 72
Thanks: 11
Thanked 7 Times in 7 Posts
raghav.kamal is on a distinguished road
Re: Capture the objects in a word document

Also many times qtp wont recognise the same script u have recorded also ..
So its always better we do it descriptively
Reply With Quote
  #6 (permalink)  
Old 04-11-2007
Junior Member
 
Join Date: Feb 2007
Location: India
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
prasadgali is on a distinguished road
Unhappy Re: Capture the objects in a word document

Hi raghav,

This is Prasad.You are saying that descriptive programming suitable for word document which is right.Could you please send me the scrippt which is used to identify a object in the file menu.
Reply With Quote
  #7 (permalink)  
Old 04-20-2007
Expert Member
 
Join Date: Apr 2007
Location: Kolkata
Posts: 151
Thanks: 3
Thanked 11 Times in 10 Posts
debleena23 is on a distinguished road
Re: Capture the objects in a word document

Hi raghav.kamal
the code that you have give is for Excel and not Word. Can you please give the code for Word Document
Reply With Quote
  #8 (permalink)  
Old 05-01-2008
Junior Member
 
Join Date: May 2008
Location: earth
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bgonepudi is on a distinguished road
Re: Capture the objects in a word document

cAN sOME ONE help me with this....I am trying to do is in my application.Where i will be exporting the data to excel , will save in .xls and has converted it .csv,
Below is my code

Set Excelobj = CreateObject("Excel.Application")
ExcelObj.visible = True
ExcelObj.Workbooks.open "C:\Documents and Settings\bdevineni\Desktop\"&File_Name&".xls"
ExcelObj. ActiveWorkbook.SaveAs "C:\Documents and Settings\bdevineni\Desktop\"&File_Name&".csv",6
set WorkSheetAct = ExcelObj.ActiveSheet
wait(5)
ExcelObj.Quit()
set ExcelObj = Nothing
next

I am getting error asking me do u want to save this yes and no ...when i click on yes it is overwritting the existing one,when i am saying no the application is getting closed.Can someone help me where i can say no and close the application here.Modify my code if need.

Thank U All.
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
XML - Document Type Definitions (DTD) Lokesh M AJAX & XML 2 04-23-2007 12:56 AM
I cannot capture new window. Geek_Guest Testing Issues 1 03-26-2007 11:12 AM
Need to write into word document through VB.NET Geek_Guest VB.NET 0 02-24-2007 05:54 AM
base line document yagnkan Test Cases 5 02-12-2007 02:50 PM
Retrieve a pdf document from database Lokesh M Database General 5 12-18-2006 08:44 AM


All times are GMT -4. The time now is 03:37 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved