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. |
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....
|
|||||||
|
|||
|
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. |
| Sponsored Links |
|
|||
|
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- |
|
|||
|
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 |
|
|||
|
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- |
|
|||
|
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. |
|
|||
|
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. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
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 |