Excel VBA: Navigate Digital Certificate

When running the below code in Excel VBA, two Internet Explorer Certificate messages appear. They specifically appear when it gets to  the fifth line (i.e., ".send".) What VBA code do I add to the below code to make it physically navigate the two certificate messages I mentioned above? (i.e., 'Click Enter, Tab, Enter etc.,)

Keep in mind that this can be kind of tricky, because VBA pauses as soon as the certificates appear and continues only after the certificates are navigated. I was thinking maybe there is a way to force the certificates to appear without VBA pausing and somehow using API to navigate them. (Pictures of the Certificates are attached.)

Dim vGetHttp
Dim vUrlLink as string   '<-----https link designated by the user.
Set vGetHttp = CreateObject("MSXML2.XMLHTTP.6.0")
vGetHttp.open "Post", vUrlLink, False
vGetHttp.send  '<----------------Internet Explorer Certificates appear after this line initiates.
Msg-Cert1.JPG
Msg-Cert2.JPG
ouestqueAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

xtermieCommented:
For the first case/image it seems like you need to install your certificate for the current user
1.  Navigate to your target URL in Internet Explorer, ignore any cert warnings it gives you.
2.  Click the "lock" near the address bar (assuming IE7 or 8),
3.  Hit the "View Certificates", then go to the "Certification Path" tab.
4.  Double-click the topmost one- if no certificates, just go back to the "General" tab (you're already on the root cert in that case).
5.  Click "Install Certificate" and click through the import wizard.

If it still doesn't work, try installing Fiddler and watching the SSL negotiation- you can see why it might fail (invalid certificate dates, etc). You can tweak the generated VBA client sometimes to get past these issues, but again, it's best to just use a real and valid cert on the server if you're doing this for a production app

For the second case it seems to be different.
In both cases you can try sending keys to accept the windows' default (and accept in the 2nd case).  Read more here:
https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys(v=vs.110).aspx
and
http://www.contextures.com/excelvbasendkeys.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ouestqueAuthor Commented:
Hey xtermie. I have a couple of questions about your answer.

Part 1: Before reviewing your answer, I already had a valid certificate installed. Are you saying I should re-install it? Currently data is pulled correctly. Nonetheless, each time VBA runs to pull the data, the certificate appears and the user has to navigate the certificate for the code to continue pulling data successfully. My goal is to make it so that the user does not have to accept a certificate each time the VBA runs.  Is it possible the vendor designed the certificate this way? Is it possible to accept a cert once and never have to accept it again?

Part 2: In my question, I mentioned that the VBA code pauses right at line 5 (i.e., vGetHttp.send) and waits for the user to navigate the certificates. Once this is done the VBA continues successfully. Problem is no more VBA runs, including SendKeys, until the user navigates the certificates. Are you saying there is a way to force SendKeys to run and navigate the certificates, even though VBA is paused? If so how?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.