Here is the script and instructions on how to install it.

helge

Registered Users (C)
1. Run Excel
2. Tools|Macro|Visual Basic Editor
3. Under "VBA Project" item click on "ThisWorkbook" item
4. Paste the attached VBA script
5. Save your workbook
6. Close VB EDitor
7. Tools|Macro|Macros...
8. Run "StartScan" function
9. Enter the requested parameters and wait till "done" message
10. Tools|Macro|Macros...
11. Run "MakeChart" function

Note: if you want to run this script for a service center other than Vermont than simply do a find/replace of 'eac' with the service center acronym that applies.

!!!Thanks to the guys on the WAC board who posted this script!!!
 
Last edited by a moderator:
Can someone post the script here as a message? I am unable to download the txt file because of firewall issues.

TIA.
 
helge

Thank you for sharing the great script.

I just tested and it works fine using MS excel-97.

I don't know how to run macro from Microsoft spreadsheet... is any one know ?

Once again thanks for sharing a good script.
 
For the folks with firewall problems...

Here is the script part 1 of 2...Please note that the script was longer than the 10,000 symbols allowed to post in a single message.
=====start of part 1 =======================
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Public Sub StartScan()
On Error Resume Next

Dim ws As Worksheet
Set ws = ActiveSheet

eacYearDay = GetSetting("I485", "Settings", "eacYearDay", "02-001")
eacYearDay = InputBox("Enter ND year and day (first 5 digit of eac #) in format YY-DDD", "Excel", eacYearDay)
If eacYearDay = "" Then Exit Sub
eacYear = CInt(Left(eacYearDay, 2))
eacDay = CInt(Right(eacYearDay, 3))
If Mid(eacYearDay, 3, 1) <> "-" Or Len(eacYearDay) <> 6 Or Err <> 0 Then
MsgBox "Incorrect value"
Exit Sub
End If
SaveSetting "I485", "Settings", "eacYearDay", eacYearDay

sheetName = "eac" & Format(eacYear, "00") & "-" & Format(eacDay, "000")
Set ws = Nothing
Set ws = Worksheets(sheetName)
If Not ws Is Nothing Then
MsgBox "eac list worksheet " & sheetName & " already exists" & vbCrLf & _
"Statuses for only listed eac numbers will be checked and updated" & vbCrLf & _
"If you want to start from scratch just delete or rename this worksheet"
Else
Err.Clear
eacRange = GetSetting("I485", "Settings", "eacRange", "50001-59999")
eacRange = InputBox("Enter range of last 5 digits of eac # in format #####-#####", "Excel", eacRange)
If eacRange = "" Then Exit Sub
eacStart = CLng(Left(eacRange, 5))
eacEnd = CLng(Right(eacRange, 5))
If Mid(eacRange, 6, 1) <> "-" Or Err <> 0 Then
MsgBox "Incorrect value"
Exit Sub
End If
SaveSetting "I485", "Settings", "eacRange", eacRange
End If
If MsgBox("Are you sure you want to start scan process?", vbYesNoCancel) = vbYes Then
Set browser = Nothing
RestartBrowser browser

If ws Is Nothing Then
Set ws = Worksheets.Add
ws.Name = sheetName
PopulateSheet browser, ws, eacYear, eacDay, eacStart, eacEnd
Else
ws.Activate
ws.Range("D1").Select
Selection.RemoveSubtotal
UpdateSheet browser, ws
End If

browser.Visible = False
Set browser = Nothing
MsgBox "Done"
End If
End Sub


Public Sub MakeChart()
Dim ws As Worksheet
Set ws = ActiveSheet
If ws.Cells(1, 1) <> "eac" Then
MsgBox "Please activate eac list worksheet"
End
End If
ws.Range("D1").Select
Selection.RemoveSubtotal
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range("C2") _
, Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
Selection.Subtotal GroupBy:=4, Function:=xlCount, TotalList:=Array(4), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
ws.Outline.ShowLevels RowLevels:=2
lastRow = ws.UsedRange.Rows.Count
total = ws.Cells(lastRow, 4)
If Val(total) < 1 Then
MsgBox "Could not find correct grand total value"
Exit Sub
End If
Charts.Add
With ActiveChart
.ChartType = xlPie
.SetSourceData Source:=ws.Range("C2:C" & (lastRow - 1) & ",D2:D" & (lastRow - 1)), PlotBy:=xlColumns
.Location Where:=xlLocationAsNewSheet
.HasTitle = True
.ChartTitle.Characters.Text = ws.Name & " on " & Now & vbCrLf & "Total: " & total
.HasLegend = False
.ApplyDataLabels Type:=xlDataLabelsShowLabelAndPercent, LegendKey:=False, HasLeaderLines:=True
.PlotArea.Border.Weight = xlThin
.PlotArea.Border.LineStyle = xlNone
.PlotArea.Interior.ColorIndex = xlNone
End With
End Sub

Sub UpdateSheet(in_browser, in_sheet)
For nextRow = 2 To in_sheet.UsedRange.Rows.Count
eac = in_sheet.Cells(nextRow, 1)
If Left(eac, 3) = "eac" Then
in_sheet.Rows(nextRow).Select
old_status_group = in_sheet.Cells(nextRow, 4)
If InStr(old_status_group, "Approved/Completed") = 0 And _
InStr(old_status_group, "Denied/Withdrawn") = 0 _
Then
Dim new_status, new_status_group, new_date
GetStatus in_browser, eac, new_status, new_status_group, new_date
If new_status <> "" Then
in_sheet.Cells(nextRow, 1) = eac
in_sheet.Cells(nextRow, 2) = new_status
in_sheet.Cells(nextRow, 3) = new_date
in_sheet.Cells(nextRow, 4) = new_status_group
End If
End If
End If
Next
End Sub

Sub PopulateSheet(in_browser, in_sheet, in_year, in_day, in_start, in_end)
in_sheet.Cells.Clear
in_sheet.Cells(1, 1) = "eac"
in_sheet.Cells(1, 2) = "Status"
in_sheet.Cells(1, 3) = "Date"
in_sheet.Cells(1, 4) = "Status Group"
in_sheet.Rows(1).Font.Bold = True
For j = in_start To in_end
Dim eac, status, status_group, status_date
eac = "eac" & Format(in_year, "00") & Format(in_day, "000") & Format(j, "00000")
status = ""
GetStatus in_browser, eac, status, status_group, status_date
If status <> "" Then
nextRow = in_sheet.UsedRange.Rows.Count + 1
in_sheet.Cells(nextRow, 1) = eac
in_sheet.Cells(nextRow, 2) = status
in_sheet.Cells(nextRow, 3) = status_date
in_sheet.Cells(nextRow, 4) = status_group
End If
Next
End Sub

Sub RestartBrowser(in_browser)
On Error Resume Next
If Not in_browser Is Nothing Then
in_browser.Visible = False
Set in_browser = Nothing
End If
Set in_browser = CreateObject("InternetExplorer.Application")
If in_browser Is Nothing Then
MsgBox "Could not start InternetExplorer"
End
End If
in_browser.Visible = True
in_browser.Navigate "https://egov.ins.usdoj.gov/graphics/cris/jsps/caseStat.jsp"
WaitTillReady in_browser
End Sub

Sub WaitTillReady(in_browser)
While in_browser.ReadyState <> 4
If in_browser.Visible = False Then
MsgBox "Script aborted"
End
End If
DoEvents
Sleep 50
Wend
End Sub

==== end of part 1 =======
 
part two of script...

======= start of part 2 ===========
Sub GetStatus(in_browser, in_eac, out_status, out_status_group, out_date)
out_status = ""
out_status_group = ""
out_date = "???"
Do
statusURL = "https://egov.ins.usdoj.gov/graphics/cris/jsps/caseRes.jsp"
Dim PostData() As Byte
PostData = "appReceiptNum=" & in_eac & "&Submit=Search"
PostData = StrConv(PostData, vbFromUnicode)
Headers = "Content-Type: application/x-www-form-urlencoded" & vbCrLf
in_browser.Navigate statusURL, 0, "", PostData, Headers
WaitTillReady in_browser
If in_browser.Document.Location <> statusURL Then
RestartBrowser in_browser
Else
pageText = in_browser.Document.documentElement.innerText
If InStr(pageText, "Servlet Exception") > 0 Then
RestartBrowser in_browser
in_browser.Refresh
WaitTillReady in_browser
Else
If InStr(pageText, "Application Type: I485") > 0 Then
If InStr(pageText, "This case has been approved") > 0 Then
out_status = "Approved"
out_status_group = "Approved/Completed"
ElseIf InStr(pageText, "after approving your application") > 0 Then
out_status = "Card ordered"
out_status_group = "Approved/Completed"
ElseIf InStr(pageText, "mailed you a receipt") > 0 Or _
InStr(pageText, "was received here for processing") > 0 Then
out_status = "Received"
out_status_group = out_status
ElseIf InStr(pageText, "written decision in this case was mailed") > 0 Then
out_status = "Denied"
out_status_group = "Denied/Withdrawn"
ElseIf InStr(pageText, "transferred your I485") > 0 Then
out_status = "Transferred"
out_status_group = out_status
ElseIf InStr(pageText, "processing has resumed") > 0 Then
out_status = "Resumed"
out_status_group = "Resumed/FP recvd"
ElseIf InStr(pageText, "has been completed") > 0 Then
out_status = "Completed"
out_status_group = "Approved/Completed"
ElseIf InStr(pageText, "requesting additional evidence") > 0 Then
out_status = "RFE sent"
out_status_group = out_status
ElseIf InStr(pageText, "received your response to our request for evidence") > 0 Then
out_status = "RFE recvd"
out_status_group = out_status
ElseIf InStr(pageText, "was rejected as improperly filed and was mailed back for correction") > 0 Then
out_status = "Rejected"
out_status_group = "Misc"
ElseIf InStr(pageText, "mailed a notice requesting that you appear for fingerprint") > 0 Then
out_status = "FP sent"
out_status_group = out_status
ElseIf InStr(pageText, "were collected and are pending review") > 0 Then
out_status = "FP recvd"
out_status_group = "Resumed/FP recvd"
ElseIf InStr(pageText, "notice acknowledging withdrawal") > 0 Then
out_status = "Withdrawn"
out_status_group = "Denied/Withdrawn"
ElseIf InStr(pageText, "mailed directly to the person to whom issued") > 0 Then
out_status = "Mailed directly"
out_status_group = "Misc"
ElseIf InStr(pageText, "was returned as undeliverable") > 0 Then
out_status = "Undeliverable"
out_status_group = "Misc"
ElseIf InStr(pageText, "insufficient payment") > 0 Then
out_status = "Insufficient payment"
out_status_group = "Misc"
Else
out_status = "Unknown"
out_status_group = "Misc"
End If
GetStatusDate pageText, out_date
End If
Exit Do
End If
End If
Loop
End Sub



Sub GetStatusDate(in_text, out_date)
On Error Resume Next
months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
For Each statusMonth In months
pos = InStr(in_text, statusMonth)
If pos > 0 Then
out_date = CDate(Mid(in_text, pos, Len(statusMonth) + 9))
Exit For
End If
Next
End Sub
====end of script =======================
 
helge

Thank you for sharing the great script.

I just tested and it works fine using MS excel-2000.


Good luckk to you
:) :) :)
GCFeeling
RD 09/14/01
 
Hey, I wanted to ask everybody who is using the script to post the results for what they found. With this we can get a good handle on how many I-485 cases are out there and (once the INS has updated the new software) how many cases are approved in one day. With that info we could better estimate the processing times.

We have already the following stats for the days (02)108 and (02)109:
Eac02108 Stats (from Helge):
I-485s Total = 462
Received = 53
FP sent = 7
Resumed/FP received = 380
Transferred = 20
Card Ordered = 2

EAC-02-109 Stats (from Janta):
Card ordered 3
Denied 1
FP recvd 6
FP sent 2
Received 28
Resumed 300
Transferred 14
Unknown 1
Grand Total 355
 
Top