Solved

dealing with windows popups

Posted on 2013-11-17
5
216 Views
Last Modified: 2013-11-18
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
0
Comment
Question by:rutgermons
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Technodweeb
ID: 39655378
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.
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 39658163
Does it help if you use
Set HttpReq = CreateObject("MSXML2.ServerXMLHTTP.6.0")

and then add this above the GET line:
HttpReq.setOption 2, 13056

Regards,

Rob.
0
 

Author Comment

by:rutgermons
ID: 39658183
Cheers Rob, seems to work, is this a standard code to ignore bad certs?
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 39658193
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.
0
 

Author Comment

by:rutgermons
ID: 39658206
thanks
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question