Solved

dealing with windows popups

Posted on 2013-11-17
5
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Gregory Miller
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

732 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