Link to home
Start Free TrialLog in
Avatar of rutgermons
rutgermons

asked on

dealing with windows popups

folks

I have a macro code that queries web urls if they are up or not, however some of them have certificate mismatches and when the macro runs the end user using excel needs to confirm the windows security alerts, how can I build code into the macro to say yes and confirm all popups ?, would be glad for your thoughts


Sub GetStatus(ByVal Ref As String)
    Dim HttpReq As Object
    Dim Rslt As Variant
   
    Set HttpReq = CreateObject("MSXML2.XMLHTTP")
   
    On Error Resume Next
    With HttpReq
        .Open "GET", ActiveSheet.Range(Ref).Value, False
        .Send
        If Err Then
            Rslt = "No connection"
        Else
            Rslt = Val(.Status)
            If Err Then
                Rslt = "No Response"
            Else
                Rslt = "Status: " & Rslt
            End If
        End If
    End With
    ActiveSheet.Range(Ref).Offset(0, 1).Value = Rslt
    ActiveSheet.Range(Ref).Offset(0, 2).Value = Now()
End Sub
Avatar of Gregory Miller
Gregory Miller
Flag of United States of America image

I think a better solution is to simply install the invalid certificate into IE of the machine running this script. You do it once and never again, or at least until the certificate invalid state changes somehow.
<link removed - GaryC123 TA>

Be aware there are differences between IE7 and earlier versions versus IE8 and later versions on how to do this. Follow the steps to the letter and you will nail this issue down. No code required.
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rutgermons
rutgermons

ASKER

Cheers Rob, seems to work, is this a standard code to ignore bad certs?
They are options for that COM object:
http://msdn.microsoft.com/en-us/library/ms763811(v=vs.85).aspx

Thanks for the grade.

Regards,

Rob.
thanks