top of page

VBA Code to Run Search on the New York State eCourts Site

Here's some VBA code posted below that I edited to run a search for a case number on the web site of New York State Unified Court System - at least for cases filed with the New York Supreme Court - the court of original jurisdiction for most civil cases in New York.

The VBA code will search for the index number you have listed in cell A2 of Sheet1.

This is based on the code posted to by snowboy001. Insert it in a module in the VBA Project list of your workbook and give it a try. You will have to enter the CAPTCHA ("Completely Automated Public Turing test to tell Computers and Humans Apart") code for the NYS court site before proceeding.

Note that there is a brief delay between the initial input of the case number and the move to the case details page.

I'm hoping this will lead to bigger things soon . . .

Sub Login() Dim appIE As InternetExplorer Dim sURL As String Dim UserN As Variant, Pw As Variant Dim Element As HTMLButtonElement Dim btnInput As MSHTML.HTMLInputElement Dim ElementCol As MSHTML.IHTMLElementCollection Application.ScreenUpdating = False Set appIE = New InternetExplorer sURL = "" With appIE .navigate sURL .Visible = True End With Do While appIE.Busy Loop Application.Wait (Now + #12:00:05 AM#) Set UserN = appIE.document.getElementsByName("txtIndex") If Not UserN Is Nothing Then UserN(0).Value = Sheets("Sheet1").Range("A2")

End If

Set ElementCol = appIE.document.getElementsByTagName("btnFindCase") With appIE .document.forms(0).submit End With Do While appIE.Busy Loop Application.ScreenUpdating = True Set appIE = Nothing

End Sub

bottom of page