Function PageAuthorized(ByVal strUrl As String, ByVal strUserId As String, ByVal strPwd As String) As Boolean
    Dim strHtml                 As String
    Dim objPat                  As Object
    Dim lngLoop                 As Long
    Const strPSoftLoginPageUrl  As String = “http://gmail.com”
    Const strPattern            As String = “You are not authorized for this page.”
    With CreateObject(“MSXML2.XMLHTTP”)
        .Open “post”, strPSoftLoginPageUrl, False
        .setRequestHeader “Content-type”, “application/x-www-form-urlencoded”
        .send “userid=” & strUserId & “&pwd=” & strPwd
        .Open “get”, strUrl, False
        .setRequestHeader “Content-type”, “application/x-www-form-urlencoded”
        .send
        strHtml = .responseText
    End With
    With CreateObject(“VBScript.Regexp”)
        .Global = True
        .ignoreCase = True
        .Pattern = strPattern
        Set objPat = .Execute(strHtml)
    End With
    PageAuthorized = (objPat.Count > 0)
End Function