Solved

dealing with windows popups

Posted on 2013-11-17
5
201 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now