I've created a macro 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
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