I have some code that calls an external program. I have this being called in a loop. Some times, I will get a "Run-time error -'5'" Invalid Procedure call or argument.
Is seems that the excel code just needs to refire the same statement.
How would I do this?
Here is the segment of code that trips up:
For I = 1 To 12
hwnd = FindWindow("#32770", "Advanced Customer Service Representative")
If hwnd > 0 Then
If FindWindowEx(hwnd, 0, "Static", "CXC09E - EQUIPMENT NOT FOUND") > 0 Then submitSNtoCSG = "CXC09E - EQUIPMENT NOT FOUND"
If FindWindowEx(hwnd, 0, "Static", "Please enter a valid selection criteria.") > 0 Then submitSNtoCSG = "Invalid Selection"
If FindWindowEx(hwnd, 0, "Static", "The equipment entered does not belong to a customer." & Chr(10)) > 0 Then submitSNtoCSG = "Not Owned"
If submitSNtoCSG = "" Then submitSNtoCSG = "UnKnown"
'
DoEvents
'*********' Need to add in error trap if it errors out, I need to re call the appactivate
AppActivate ("Advanced Customer Service Representative - Common Search")
SendKeys "{ENTER}", True
'End If
End If
' Debug.Print "I", I
hnd4 = FindWindow(vbNullString, "Common Search")
Hnd6 = FindWindowEx(5048016, 0, "Edit", "0015A3186B7F")
' EQUIPMENT Not FOUND
Next I
Thanks
Bruce
Bookmarks