0

My employer uses SAP to generate purchase order numbers. The PO number is displayed in a popup window. I need to use VBA and SAP GUI Scripting to copy the PO number (or the whole text) so that it can be pasted into Excel.

I have tried using the SAP GUI script recording tool to get the command (it doesn't record the mouse clicks to select and copy, nor the keyboard commands), and it won't let me print to One Note or Microsoft XPS Document Writer.

Any suggestions would be greatly appreciated. Image of the popup window is here:

Image

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • Try [FindWindow API as shown in this SO Q&A](http://stackoverflow.com/questions/25098263/how-to-use-findwindow-to-find-a-visible-or-invisible-window-with-a-partial-name) – Scott Holtzman May 09 '17 at 18:57

1 Answers1

0

The message is displayed in the status bar at the lower end of the screen. with VBA you can read this as follows:

STATUS_BAR_TEXT = session.findById("wnd[0]/sbar").Text
aristotll
  • 8,694
  • 6
  • 33
  • 53
Karl
  • 1
  • 2
    Welcome to Stackoverflow. Would you mind extending your answer, for fellow programmers, to understand how exactly it helps to solve the problem? – Nagama Inamdar Sep 22 '17 at 13:24