Skip to Content
avatar image
-1
Former Member

VB Script error message "Unable to write read-only property

Hi, As you can see the below program to create a simple BA but when included additional line of code to accommodate excel spread sheet for mass BA creation actually locks the spreadsheet to read only which is preventing the script to run through. Please help. Thanks

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"

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers