0 votes
in VBA by Beginner (2 points)
I have VBA code behind an application that calls a website url where the website requires authentication to access and the authentication comes in the form of a a Windows Security pop-up box, not imbedded web elements.  So I created a logon.vbs script to login to the website and am attempting to call the script by using Shell "Explorer.exe""C:\Temp\Logon.vbs""",1 but it does not seem to be running the vbs file.  The Windows security pop-up box appears and if I manually run the vbs file it's using sendkeys to send the login information and will run just fine, but if I run my application which calls the webpage and then attempts to call the vbs file, the vbs script never sends the sendkey information over to the pop-up.  Looking for ideas on why the vbs file is not executing.

1 Answer

0 votes
by Skilled (466 points)
edited by

Instead of 

    Shell "Explorer.exe""C:\Temp\Logon.vbs"""

try this

    Dim oShell As Object
    Set oShell = CreateObject("WScript.Shell")
    oShell.Run "C:\Temp\Logon.vbs", nHide

where nHide = 0 to hide the Shell window or nHide = 1 to show it.
If you still have trouble, you can set the default path before oShell.Run using 
    oShell.CurrentDirectory = ...

 

Welcome to wellsr Q&A
wellsr Q&A is the VBA and Python programming community that rewards you for learning how to code.

Getting Started
Register
VBA Cheat Sheets (On Sale Now)

Earn free prizes for asking VBA and Python questions and for answering questions asked by others in our community.

Looking for something else? Hire our professional VBA Help, instead.

What makes us different?
Our points system rewards you with a chance for free gifts based on the quality of your questions and answers. All you have to do is post and you could get rewarded, like these members:

ParserMonster $25 Amazon Gift Card
Hightree $10 Amazon Gift Card
Thales1 $10 Amazon Gift Card
runfunke $10 Amazon Gift Card
coolag $10 Amazon Gift Card
Siew Hun $10 Amazon Gift Card

So, why don't you join us? It really is an encouraging way to motivate members in our VBA and Python community.

Register

For more programming tips visit the VBA Tutorials Blog and the Python Tutorials Blog.

...