VBA for Saving a PDF that was opened in IE.

Hawk3116

New Member
Joined
Jun 16, 2014
Messages
15
I am trying to create a script that will go into SAP ( the system we use at work) open an invoice in sap and save it to a specific folder. I have the first part that opens up the invoice working perfectly but I am stuck on the saving part. Once I click on the invoice it opens adobe pdf viewer in IE and I'll get an address that looks like this:
PHP:
'http://tmprapps06.XXXX.net:8080/archive?get&pVersion=0045&contRep=P1&docId=r5jo5r31en6vhmdu2njsj3fmdoya3
and obviously this address will change with every invoice.
I am not sure if this is even possible but any help I can get would be greatly appreciated as I would be a hero at work. Below is the code I already have but I am not sure how much help it will be as this already works:

PHP:
session.FindById("wnd[0]").Maximize
session.FindById("wnd[0]/tbar[0]/okcd").Text = "/nea40"
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]/usr/ctxtERDK-OPBEL").Text = InvoiceNumber
session.FindById("wnd[0]/usr/ctxtERDK-OPBEL").CaretPosition = 11
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]/tbar[1]/btn[16]").Press

session.FindById("wnd[1]/usr/cntlCUSTOM_CONTAINER_100/shellcont/shell").SetCurrentCell -1, "BITM_DESCR"
session.FindById("wnd[1]/usr/cntlCUSTOM_CONTAINER_100/shellcont/shell").SelectColumn "BITM_DESCR"
session.FindById("wnd[1]/usr/cntlCUSTOM_CONTAINER_100/shellcont/shell").PressColumnHeader "BITM_DESCR"
session.FindById("wnd[1]/usr/cntlCUSTOM_CONTAINER_100/shellcont/shell").SetCurrentCell -1, "BITM_DESCR"
session.FindById("wnd[1]/usr/cntlCUSTOM_CONTAINER_100/shellcont/shell").SelectColumn "BITM_DESCR"
session.FindById("wnd[1]/usr/cntlCUSTOM_CONTAINER_100/shellcont/shell").PressColumnHeader "BITM_DESCR"
session.FindById("wnd[1]/usr/cntlCUSTOM_CONTAINER_100/shellcont/shell").CurrentCellColumn = "BITM_DESCR"
session.FindById("wnd[1]/usr/cntlCUSTOM_CONTAINER_100/shellcont/shell").SelectedRows = "0"
session.FindById("wnd[1]/usr/cntlCUSTOM_CONTAINER_100/shellcont/shell").DoubleClickCurrentCell

Thank you in advance to any help that anyone can give me.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,214,824
Messages
6,121,783
Members
449,049
Latest member
greyangel23

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