Save roport as file via Windows explorer
Macro error interfacing with SAP after Window 7 Update
I've created a macro in Excel that opens SAP, and downloads a number of different reports. It was working fine last week, but after an update to Windows 7 from xp (and excel 2007 to 2010), I now receive the following error during a loop in my code:
Run-time error '619'
The control could not be found by id
I have no idea what change could have caused this. If anyone has any ideas I would really appreciate it!
The error occurs at the following line:
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell[1]").setDocument 1, ""
The loop is here:
For i = StartPeriod To 13
session.findById("wnd[0]/usr/txt[7]").text = "201" & Ye
session.findById("wnd[0]/usr/txt[9]").text = "201" & Ye
session.findById("wnd[0]/usr/txt[11]").text = i
session.findById("wnd[0]/usr/txt[13]").text = i
session.findById("wnd[0]/usr/ctxt[0]").caretPosition = 9
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/tbar[1]/btn[45]").press
session.findById("wnd[1]/usr/sub/2/sub/2/1/rad[1,0]").select
session.findById("wnd[1]/usr/sub/2/sub/2/1/rad[1,0]").setFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/ctxt[0]").text = OutputFilePath
session.findById("wnd[1]/usr/ctxt[1]").text = "Y1" & Ye & "P" & i & ".txt"
SendKeys "~", True
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell[1]").setDocument 1, ""
session.findById("wnd[0]/tbar[0]/btn[3]").press
If Ye <> CurrentYe And i = 13 Then
i = 0
Ye = Ye + 1
End If
If Ye = CurrentYe And i = PeriodUsed Then GoTo Line91
Next i
How to read the record file programmatically
Hi all,
I'm new to SAP and SAP GUI Scripting.
I've 2 questions that need your expertise to enlighten me.
1. session.RecordFile = "myfile" <- this will created under SapWorkDir
Q: Is there a way to know exact directory based on the variable SapWorkDir without hardcode it?
I need to use program to read this "myfile". Main reason no hardcode, I may have different SAP Gui Clients on different environments (XP, Win7 etc)
2. If above solution does not work
I know another alternative, using "_Change" event to record it myself. Is there any good sample?
Hope i can get some hints from you guys.
Cheers
Sato
T-code KSII script need further help
Hi, i recently posted discussion "T-code KSII script post despite errors". I have a follow-on question. Sometimes, when i try to post data, there are errors, so I have this code: 'This posts the data despite the errors If session.findById)"wnd[1]/usr/txtSPOP-TEXTLINE1").text = "Do you want to post data despite errors" Then session.findById("wnd[1]/usr/btnSPOP-OPTION1").press End If 'This selects the enter button when a pop-up box comes up to tell you that the data has been posted If session.findbyId("wnd[1] /usr/txtMESSTXT2").txt = "Data has been posted" Then session.findById("wnd[1]/tbar[0]/btn[0]").press But, when i try to post the data that doesn' t have "errors", the first pop-up box that says "Do you want to post data despite errors" does not pop-up. Which means that only the second pop-up box comes up ("Data has been posted"). How can i edit the code to take care of both situations? I tried this: If session.findById("wnd[1]/usr/txtSPOP-TEXTLINE1").text = "Do you want to post data despite errors" Then session.findById("wnd[1]/usr/btnSPOP-OPTION1").press Else If session.findById("wnd[1]/usr/txtMESSTXT2").text = "Data has been posted" Then session.findById("wnd[1]/tbar[0]/btn[0]").press End If But it didn't work. Can anybody help?! Thanks, Chrissy
IF double click cant be read in scripting
Hi Everyone I hope someone could help me with my issue. After entering Tcode in SAP to go to main where I will need to get information to export to excel. So after Tcode I need to double click "Find Case" in SAP Seems VBS cant read that move when I am recording it..
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "udm_dispute"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").expandNode " 2"
session.findById("wnd[0]/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").topNode = " 1"
session.findById("wnd[0]/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").selectedNode = " 4"
session.findById("wnd[0]/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").doubleClickNode " 4"
Please Help
Set the "Not Equal" selection option for GuiCTextField
I'm writing the script in AutoIt, but this is more of a general question.
Relevant parts of script:
$sess.SendCommand("/nSE16")
$sess.ActiveWindow().FindByID("usr/ctxtDATABROWSE-TABLENAME").Text = "MAPL"
$sess.ActiveWindow().FindByID("usr/ctxtI2-LOW").Text = "1000"
$sess.ActiveWindow().FindByID("usr/ctxtI3-LOW").Text = "N"
$sess.ActiveWindow().FindByID("usr/ctxtI11-LOW").Text = "X"
$sess.ActiveWindow().FindByID("tbar[1]/btn[7]").Press()
$sess.ActiveWindow().FindByID("tbar[1]/btn[8]").Press()
_SaveLocalFile($mypath, "CRHD.txt")
$sess.ActiveWindow().SendVKey(12)
$sess.ActiveWindow().SendVKey(12)
I need to set the usr/ctxtI11-LOW to "Not Equal X". I can do this, but I was wondering if there was an option I was missing.
;~ vvvvv Is there an easier way to do this?
$sess.ActiveWindow().FindByID("usr/ctxtI11-LOW").Text = "X"
$sess.ActiveWindow().findById("usr/btn%_I11_%_APP_%-VALU_PUSH").press
$sess.ActiveWindow().findById("usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/btnRSCSEL-SOP_I[0,0]").press
$sess.ActiveWindow().findById("usr/cntlOPTION_CONTAINER/shellcont/shell").currentCellRow = 5
$sess.ActiveWindow().findById("usr/cntlOPTION_CONTAINER/shellcont/shell").selectedRows = "5"
$sess.ActiveWindow().findById("usr/cntlOPTION_CONTAINER/shellcont/shell").doubleClickCurrentCell
;~ ^^^^^ Is there an easier way to do this?
parameters sintax for BAPIs in PHP?
Hi,
can someone help me with the parameters sintax for these bapis (bapi_salesorder_createfromdat2 and bapi_transaction_commit) in PHP?
More details ...
I wrote a PHP script calling thats bapis, I sent the values in arrays. When I ran the script I got any error, but it shows a list of empty data and at the bottom the follow messages:
No errors detected.
call function 'BAPI_TRANSACTION_COMMIT' successfull.
But there is no sales order created in the database.
I think, the sintax for the parameters are wrong or maybe all my logic
Attach files: My PHP script and a file with the output of the execution (please change the extensions
I'm using wampserver 2.2 installed locally ( apache 2.2.21 - PHP 5.3.8 ) my SAP QAS is in Oracle.
thanks
-- sorry for my pour english --
How to close SAP, independent from the SAP state
Hello,
i am looking for a way to close SAP with a VBA Script, independent from the SAP state.
Sometims a SAP table is open. Then the code works fine without an error, but SAP dossn't close.
Thank you for your Support
my code:
If SAP_GUI_APP Is Nothing Then
Set SAP_GUI_APP = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Connection Is Nothing Then
Set Connection = SAP_GUI_APP.OpenConnection("XYZ", True)
End If
If session Is Nothing Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject Application, "on"
End If
and so on...
If sbar.text <> "" Then GoTo FEHLER
fehler:
Set sbar = Nothing
Set WScript = Nothing
Set session = Nothing
Set Connection = Nothing
Set SAP_GUI_APP = Nothing
end sub
How to get Transaction Name
Hi all,
Let say the script
session.Info().Transaction <- this gives you the transaction code. How about name?
Eg. SU3 - Maintain User Own Data
Possible? I search through the API could not find any.
Cheers
Sato
Scripting to view changes in Order
Hi Experts,
I'm new here and I need your help.
I've created an script to save a file with changes in order.
The script works fine, but i need to know, if it´s possible get this information from a list of orders (Excel or access)?
I also need to know if it´s possible to save on the same file the informations from diferent orders.
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "va03"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtVBAK-VBELN").text = "1009023776"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/mbar/menu[4]/menu[3]").select
session.findById("wnd[0]/usr/radSDATE").select
session.findById("wnd[0]/usr/radSDATE").setFocus
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/mbar/menu[3]/menu[5]/menu[2]/menu[2]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "testemodificacao.xls"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 20
session.findById("wnd[1]/tbar[0]/btn[11]").press
session.findById("wnd[0]/tbar[0]/btn[15]").press
session.findById("wnd[0]/tbar[0]/btn[15]").press
session.findById("wnd[0]/tbar[0]/btn[15]").press
Tks
Excel VBA SAP logon pad
Hello,
I have successfully written VBA code to emulate user interaction with SAP on one "system". However when i want to switch over to another SAP system i have been unsuccessful. I may be using the wrong terminology referring to the systems, for example, on the SAP logon pad 710 i have a list of 56 system's i can log in to. I only use two of those systems, one is called SAP ECC production [BH1] and the other is called SAP SCM 5.0 Production [BA1]. in the middle of my code i would like to switch over to the second system (SAP SCM 5.0) but i have not been able to do it. Any help would be tremendous! Thank you
Script to view change in orders
Hi Experts,
I'm new here and I need your help.
I've created an script to save a file with changes in order.
The script works fine, but i need to know, if it´s possible get this information from a list of orders (Excel or access)?
I also need to know if it´s possible to save on the same file the informations from diferent orders.
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "va03"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtVBAK-VBELN").text = "1009023776"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/mbar/menu[4]/menu[3]").select
session.findById("wnd[0]/usr/radSDATE").select
session.findById("wnd[0]/usr/radSDATE").setFocus
Scsession.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/mbar/menu[3]/menu[5]/menu[2]/menu[2]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").setFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "testemodificacao.xls"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 20
session.findById("wnd[1]/tbar[0]/btn[11]").press
session.findById("wnd[0]/tbar[0]/btn[15]").press
session.findById("wnd[0]/tbar[0]/btn[15]").press
session.findById("wnd[0]/tbar[0]/btn[15]").press
Tks.
Script to run multiple transactions in different windows
Hi!
I've recently discovered the function of script recording in SAP, and find it very useful. I've recorded a few scripts that I use on a regular basis, but when I do, I manually open a new session and starts the different scripts in each window. Is there any way I can have one script that will run all my scripts automatically? I've searched the forum and found a few threads on similar questions, but due to my rather poor knowledge of scripting, I'm not able to convert any of the examples I found in other threads to a script that suits me. Maybe someone can write me an example I can use?
I would like to:
1. Run transaction zpm3n and execute
2. Open new session
3. Run transaction cm07 and execute
4. Open new session
5. Run tranaction IW38 and execute
I might want some additional inputs for each transaction, but I think I'm able to add this by myself.
I have a separate script for each function, if it would be easier to create a script that runs each of the others one by one.
Here is one of my scripts (recorded in SAP), how can I rewrite this to open a new session and switch to the new session?
This opens zpm3n and gets a variant I have created for this transaction.
--------START---------
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "zpm3n"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[17]").press
session.findById("wnd[1]/usr/txtV-LOW").text = "u_429395"
session.findById("wnd[1]/usr/txtENAME-LOW").text = ""
session.findById("wnd[1]").sendVKey 8
session.findById("wnd[0]/tbar[1]/btn[8]").press
-----------END-------------
Appreciate all help!
Espen
Can you import SAP Transactions (AR Inv) using excel VBA bypassing DTW?
I'm looking to create a batch of transactions that would come from excel and go directly into the SAP AR Invoices as 'draft' invoices. I would like to bypass DTW and skip a step if I could. I've seen various posts about importing static lists (auths, items, etc...), but nothing on transactions. We're using SAP 8.8
Calling SAP function from Excel
Hi Gurus,
We are facing a problem while trying to call a function module from Excel. We are pretty standard VBA code in our application however for one particular function module RSEC_CREATE_AUTHORIZATION_API, I am getting an error "Object Variable or With block variable not set " on the last line of the code copied below. Any inputs will be greatly appreciated as I have no clue about the problem with this particular function module. Thanks...
I have tested the FM in ABAP and it works as it should.
Dim objBAPIControl As Object 'Function Control (Collection object)
Dim objAuthList As Object ' Function Object
'Create the Logon Control & Function Controls
Set objBAPIControl = CreateObject("SAP.Functions")
Set objAuthList = objBAPIControl.Add("RSEC_CREATE_AUTHORIZATION_API")
'Get a connection object
Set oConnection = objBAPIControl.Connection
'Try to connect to the R/3 System
If oConnection.Logon(1, False) = False Then
MsgBox "R/3 connection failed"
Exit Sub
End If
'Declare the structure parameters
Dim exportCollection As Object
Dim authValue As Object
Set exportCollection = objAuthList.Exports
Identifying object in SAP field
Hello, is there a way to identify the control id in a field
there is a field that could either contain (this is in the messages screen of me23n)
session.findbyid("/app/con[0]/ses[0]/wnd[0]/usr/tblSAPDV70ATC_NAST3/lblDV70A-STATUSICON
or
session.findbyid("/app/con[0]/ses[0]/wnd[0]/usr/tblSAPDV70ATC_NAST3/txtDV70A-STATUSICON
and depending on which it is i need SAP to respond accordingly. How can i identify that? Thank you!
Does not return value of 'pmnttrms' parameter in 'CreateFromData1' BAPI
Does not return value of 'pmnttrms' parameter in 'CreateFromData1' BAPI.
All parameter value of PoHeader Structure is returnd except pmnttrms.
Such as incoterms1, incoterms2, currency and so on.
Why ????
i_poheader-delete_ind = gs_poheader-delete_ind.
i_poheader-doc_date = gs_poheader-doc_date.
i_poheader-vendor = gs_poheader-vendor. "VENDOR NUMBER
i_poheader-pur_group = gs_poheader-pur_group. "PURCHASE GROUP
i_poheader-doc_type = gs_poheader-doc_type.
i_poheader-comp_code = gs_poheader-comp_code. "COMPANY CODE
i_poheader-purch_org = gs_poheader-purch_org. "PURCHASING ORG.
i_poheader-creat_date = gs_poheader-creat_date. "CREATE PERSON
i_poheader-created_by = gs_poheader-created_by. "CREATE PERSON
i_poheader-item_intvl = gs_poheader-item_intvl.
i_poheader-pmnttrms = gs_poheader-pmnttrms. "PAYMENT TERM
i_poheader-currency = gs_poheader-currency. "CURRENCY
i_poheader-incoterms1 = gs_poheader-incoterms1. "INCO TERMS
i_poheader-incoterms2 = gs_poheader-incoterms2. "INCO TERMS DESC.
i_poheader-dscnt1_to = gs_poheader-dscnt1_to.
IF p_act_flg <> ''.
i_poheaderx-po_number = c_x.
ENDIF.
IF gs_poheader-delete_ind = c_d.
i_poheaderx-delete_ind = c_x.
ENDIF.
i_poheaderx-doc_date = c_x.
i_poheaderx-vendor = c_x.
i_poheaderx-pur_group = c_x.
i_poheaderx-doc_type = c_x.
i_poheaderx-comp_code = c_x.
i_poheaderx-purch_org = c_x.
i_poheaderx-created_by = c_x.
i_poheaderx-creat_date = c_x.
i_poheaderx-pmnttrms = c_x.
i_poheaderx-currency = c_x.
i_poheaderx-incoterms1 = c_x.
i_poheaderx-incoterms2 = c_x.
i_poheaderx-item_intvl = c_x.
i_poheaderx-dscnt1_to = c_x.
Creating new sessions in background/hidden
When creating a connection, I am using the /INPLACE flag to prevent the window from being visible to the end user. When I create a new session using the CreateSession method of the GuiSession object, the new session will always pop up. I can handle the CreateSession event, but I don't know what I can do with the returned GuiSession object to prevent it from showing up in the foreground.
Any solutions to keep the additional sessions silent and in the background?
I'm using c#
Thanks,
Steve
Get data from MB51 line by line
Dear team,
i want to get data from mb51 transaction line by line.
for example. for one item its can be 1 or more lines
im used next macro
For i = 2 To 10
Item = Cells(i, 1).Value
batch = Cells(i, 2).Value
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nmb51"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtMATNR-LOW").Text = Item
session.findById("wnd[0]/usr/ctxtWERKS-LOW").Text = "a667"
session.findById("wnd[0]/usr/ctxtLGORT-LOW").Text = "0001"
session.findById("wnd[0]/usr/ctxtCHARG-LOW").Text = batch
session.findById("wnd[0]/usr/ctxtBWART-LOW").Text = "325"
session.findById("wnd[0]/usr/ctxtBUDAT-LOW").Text = "01.07.2013"
session.findById("wnd[0]/usr/ctxtBUDAT-HIGH").Text = "30.10.2013"
session.findById("wnd[0]/usr/ctxtBUDAT-HIGH").SetFocus
session.findById("wnd[0]/usr/ctxtBUDAT-HIGH").caretPosition = 10
session.findById("wnd[0]/tbar[1]/btn[8]").press
For a = 5 To 10
Cells(i, 4) = session.findById("wnd[0]/usr/lbl[23," & a & "]").Text
Next
Next
but got error
VB script hangs Excel since upgrading to Windows 7
SAP version: 720
OS: Windows 7
MS Office version: Office Professional Plus 2010
We have recently upgraded to Windows 7, and while my Excel VB script continues to work just fine, it hangs at the end of executing and I have to use windows task manager to shutdown Excel. My guess is that it is some how failing to close the connection to SAP (though it SAP doesn't appear in the list of running programs). As I said, it connects to SAP and runs the script just fine, but at the end, Excel is frozen up with the little spinning "I'm thinking" wheel.
Sub SAP_test()
If Not IsObject(SAPguiApp) Then
Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
Set Connection = SAPguiApp.OpenConnection("<description of SAP connection>", True)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "<t-code I wish to execute>"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[17]").press
session.findById("wnd[1]/usr/txtV-LOW").Text = "<name of variant I wish to execute>"
session.findById("wnd[1]/usr/txtENAME-LOW").Text = "<creator of the variant I wish to exectute>"
session.findById("wnd[1]/usr/txtV-LOW").caretPosition = 11
session.findById("wnd[1]/tbar[0]/btn[8]").press
session.findById("wnd[0]/usr/tabsTABSTRIP_TABBLOCK1/tabpS_TAB4").Select
session.findById("wnd[0]/usr/tabsTABSTRIP_TABBLOCK1/tabpS_TAB4/ssub%_SUBSCREEN_TABBLOCK1:RI_ORDER_OPERATION_LIST:1400/ctxtS_ZZSCHD-LOW").Text = <string for start date>
session.findById("wnd[0]/usr/tabsTABSTRIP_TABBLOCK1/tabpS_TAB4/ssub%_SUBSCREEN_TABBLOCK1:RI_ORDER_OPERATION_LIST:1400/ctxtS_ZZSCHD-HIGH").Text = <string for end date>
session.findById("wnd[0]/usr/tabsTABSTRIP_TABBLOCK1/tabpS_TAB4/ssub%_SUBSCREEN_TABBLOCK1:RI_ORDER_OPERATION_LIST:1400/ctxtS_ZZSCHD-HIGH").SetFocus
session.findById("wnd[0]/usr/tabsTABSTRIP_TABBLOCK1/tabpS_TAB4/ssub%_SUBSCREEN_TABBLOCK1:RI_ORDER_OPERATION_LIST:1400/ctxtS_ZZSCHD-HIGH").caretPosition = 10
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/mbar/menu[0]/menu[6]").Select
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[0,0]").Select
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/tbar[0]/btn[0]").press
End Sub
Any help greatly appreciated, it's a pain having to close Excel every time I run a script and having to incude a line in the code to make it save before attemtping to exit SAP, just so I don't lose all the data every time.
Thanks,
Mark