The Following script should fetch all the saved urls from the excel sheet and check if all the links are working fine,

Please help me debug this following script, i am not getting any error but its not checking the urls i have wantedly put some junk URLS in sheet, its not checking


'Create the Excel object
Set objExcel = CreateObject("Excel.Application")

'Open the worksheet
objExcel.Workbooks.Open ("D:\Automation\TestData\WebTbl.xlsx")

'Set the Transfer Protocol
Inet = icHTTP

'This is the main function!!

'This function will be called to check all the links in the

'Declare variables
Dim var_row
Dim var_URL
Dim var_buffer
Dim var_msg
Dim var_file_not_found
Dim var_server_not_found
Dim var_timeout
Dim var_OK

'Catch the time-out errors

On Error Resume Next

'Set the row variable to the cell where the data starts
var_row = STARTROW

'Initialize the variables

var_timeout = 0
var_file_not_found = 0
var_OK = 0
var_server_not_found = 0

'Minimize the form
frmmain.WindowState = 1

'Loop through all the URLs
'Get the URL
var_URL = objExcel.Cells(var_row, URL_COL)

'Check whether the first cell is empty
If var_URL = "" Then Exit Do

'Open the URL
Text1 = Inet1.OpenURL(var_URL)

'Avoid tying up the system

'Errors messages are found in the first 50 characters
'returned by the openurl method

If Len(Text1) > 50 Then

var_buffer = Left(Text1, 50)


var_buffer = Text1

End If

'Catch a time-out error

If Err = 35761 Then
var_msg = "Timed Out"
var_timeout = var_timeout + 1

'If nothing is returned, it means that the server was
'not found

ElseIf Text1 = "" Then

var_msg = "Server not found"
var_server_not_found = var_server_not_found + 1

'If error 404 is returned from the URL, it means the
'server was found but he file was not found

ElseIf InStr(1, var_buffer, "404") Then

var_msg = "File not found"
var_file_not_found = var_file_not_found + 1

'else, the link is OK


var_msg = "OK"
var_OK = var_OK + 1

End If

'Save the result back to the worksheet

objExcel.Cells(var_row, STATUS) = var_msg

'Move to the next row

var_row = var_row + 1

'Display the current status.

frmmain.Caption = var_OK + var_file_not_found + var_server_not_found + var_timeout

'Display the results on the form

Result1 = "OK: " & var_OK
Result2 = "File not found: " & var_file_not_found
Result3 = "Server not found: " & var_server_not_found
Result4 = "Timed out: " & var_timeout

Loop While True

'If all the links have been checked, restore the form

frmmain.WindowState = 0

'Close the Worksheet


'Remove the object from the memory
Set objExcel = Nothing

'Display the results

var_buffer = "OK: " & var_OK & vbCrLf
var_buffer = var_buffer & "Server not found: " & var_server_not_found & vbCrLf
var_buffer = var_buffer & "File not found: " & var_file_not_found & vbCrLf
var_buffer = var_buffer & "Timed out: " & var_timeout

MsgBox var_buffer