VBA to check for PR SAP attachment

RodrigoFinguer

Board Regular
Joined
Jun 13, 2017
Messages
75
Code:
   Sub teste()

    Set SapGuiAuto = GetObject("SAPGUI")
    Set SAPApplication = SapGuiAuto.GetScriptingEngine
    Set SAPConnection = SAPApplication.Children(0)
    Set session = SAPConnection.Children(0)
    

        session.findById("wnd[0]").maximize
        session.findById("wnd[0]/tbar[0]/okcd").Text = "/nme53n"
        session.findById("wnd[0]").sendVKey 0

        session.findById("wnd[0]").sendVKey 17
        session.findById("wnd[1]/usr/subSUB0:SAPLMEGUI:0003/ctxtMEPO_SELECT-BANFN").Text = "Purchase Requisition"
        session.findById("wnd[1]/usr/subSUB0:SAPLMEGUI:0003/ctxtMEPO_SELECT-BANFN").caretPosition = 8
        session.findById("wnd[1]").sendVKey 0

    session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"
    Set botao = session.findById("/app/con[0]/ses[0]/wnd[0]/titl/shellcont/shell/")

I need something like this:

attach = botao.CurrentContextMenu.Children.Item(2).isfocused


My Purchase Requisition has now attachment file, then I need to know if the button "Attachment List" is avaiable to click or not.

REALLY need help with this, I am begging you.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,215,003
Messages
6,122,655
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top