keepintouch
New Member
- Joined
- Apr 19, 2018
- Messages
- 3
Guys,
Please can anyone throw some suggestions on the error when the script is run turns the excel file property to read only.
Please can anyone throw some suggestions on the error when the script is run turns the excel file property to read only.
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 Dim objExcel, objWorkbook, objSheet, i Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("C:\Users\TSK\Documents\BA06.xlsx") Set objSheet = objWorkbook.Sheets("Sheet1") For i = 2 to objSheet.UsedRange.Rows.Count Business = Trim(CStr(objSheet.Cells(i, 1).Value)) 'Column1 Name = Trim(CStr(objSheet.Cells(i, 2).Value)) 'Column2 session.findById("wnd[0]/tbar[0]/okcd").text = "ox03" session.findById("wnd[0]").sendVKey 0 session.findById("wnd[0]/tbar[1]/btn[5]").press session.findById("wnd[0]/usr/tblSAPL0ORGCORETCTRL_V_TGSB/txtV_TGSB-GSBER[0,0]").text = Business session.findById("wnd[0]/usr/tblSAPL0ORGCORETCTRL_V_TGSB/txtV_TGSB-GTEXT[1,0]").text = Name session.findById("wnd[0]/usr/tblSAPL0ORGCORETCTRL_V_TGSB/txtV_TGSB-GTEXT[1,0]").setFocus session.findById("wnd[0]/usr/tblSAPL0ORGCORETCTRL_V_TGSB/txtV_TGSB-GTEXT[1,0]").caretPosition = 19 session.findById("wnd[0]/tbar[0]/btn[11]").press next msgbox "BA Created"