Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP with MS Word
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
I am trying to access Word, and then go to the "View" Menu on the menubar.

QTP is having a hard time finding the right menu item, as it is probably looking for a screen position. This is the QTP generated code:

Code:
SystemUtil.Run "C:\Program Files\Microsoft Office\Office12\WINWORD.EXE","","",""
WinComboBox("ComboBox").Select 0
Window("Microsoft Word").WinObject("NetUIHWND").Click 717,45
Window("Microsoft Word").WinObject("Microsoft Word Document").Click 242,173

I am getting error right from the 2nd line for WinComboBox. Could you let me know how I can have QTP choose the correct menu item?
Really appreciate your help!
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Hello Rahul

1st when u open qtp and write script for access to word.
you must add object repository then run below script.
hope so its working.

Code:
SystemUtil.Run "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE","","",""
Window("Microsoft Word").Activate
Window("Microsoft Word").WinObject("Menu Bar").Click 93,13
Window("Microsoft Word").Window("View").Click 22,12

Thanks
Sonali.
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Thanks Sonali for your reply.

I am not sure what you meant by adding the object repository. Is there something to be added specifically for MS Word in the Object repository. Please explain.
I did not try running the script you gave yet. Will run and let you know if that worked. Meanwhile if you have time, please let me know if i need to add anything to the object repository.
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi All,

I have QTP11 installed and one application which needs to be opened through MS word and it is a VB Macro. QTP is NOT recognizing the objects as VBButton or VBList. I need to fix it asap. Can any one tell me what needs to be done?

Thanks,
Dipti
Reply
#5
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi Rahul,

Instead of using treating the application as a Windows application and directly recording on it, you can try using the AOM to declare an object of type Word.Application and then try to access the specific action or property you need to use.

A start would be. You could declare an object of type Word.Application.

'Code
Code:
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oWordObj = oWord.Documents.Add()

This would open a new Word Application. You can no use the oWordObj to perform your specific operation.

Thank You,
Ravi Shankar
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT Word automation wannel 1 2,334 10-31-2016, 06:59 PM
Last Post: wannel
  Can QTP AOM identify word documents that are already opened anil2u 2 4,382 09-05-2013, 12:45 PM
Last Post: anil2u
  Search for a word in excel string QAVA 6 9,339 11-23-2012, 11:17 AM
Last Post: vinod123
  Search for a word in string QAVA 5 4,492 11-22-2012, 04:50 PM
Last Post: Saleel Prabhu
  DP for identifying objects in MS Word rahul29 0 2,393 01-31-2012, 08:44 PM
Last Post: rahul29

Forum Jump:


Users browsing this thread: 1 Guest(s)