can some1 pls help me......i am writing a vbscript to remove hyperlinks linked to the graphical objects.
i am able to successfully remove the hyperlinks that are present in each worksheet. but if the worksheet is password protected then the program shuld not remove the hyperlink. in my code it also removes the hyperlink even when no password is provided.

the code that i am using is given below:

Dim sheetProtected As Boolean
Dim cancelPwd As Boolean
Dim sheetPassword As String
Dim hashyperlinks As Boolean
hashyperlinks = False
Dim i As Integer
Dim wSheet As workSheet

For Each wSheet In AppExcel.Worksheets

'Check for protected worksheet

'Turn off error checking
On Error Resume Next
If wSheet.ProtectContents = True Then
'Sheet is protected, re-protect at the end
sheetProtected = True
sheetProtected = False
End If

If sheetProtected = True Then
'Get the sheet password
AppExcel.WindowState = xlMinimized
'Set the worksheet and workbook names on the
'get password form
frmProtectsheet.strSheetName = wSheet.Name
frmProtectsheet.strWorkbookName = ObjExcel.Name

'Show the form
frmProtectsheet.Show vbModal

'Get the password and check if the user clicked
'the cancel button
sheetPassword = frmProtectsheet.txtProtectpwd
cancelPwd = frmProtectsheet.cancelPwd

If cancelPwd = False Then
'Clear errors

'Try to unprotect with the users password
wSheet.Unprotect (sheetPassword)

If Err.Number <> 0 Then
MsgBox "You have entered an incorrect password for the """ & wSheet.Name & """ worksheet in the """ + ObjExcel.Name + """ workbook. Try to retype your password or click the 'Cancel' button to bypass this worksheet.", vbOKOnly,
End If

End If
Loop While Err.Number <> 0 And cancelPwd = False
End If

For i = wSheet.Hyperlinks.Count To 1 Step -1
If wSheet.Hyperlinks(i).Type <> 0 Then
hashyperlinks = True
End If
Next i
'Turn error checking back on
On Error GoTo 0

' 'Re-protect protected sheet
If sheetProtected = True And cancelPwd = False Then
wSheet.Protect (sheetPassword)
End If

Next wSheet

can some pls help
thnxs in advance