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.
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.
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-
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
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-
Also many times qtp wont recognise the same script u have recorded also ..
So its always better we do it descriptively
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.
Hi raghav.kamal
the code that you have give is for Excel and not Word. Can you please give the code for 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.