Open a secured website using Excel VBA

Inkarr

New Member
Joined
May 21, 2010
Messages
6
I am trying to open a webpage that requests a user id and password, before the page loads.

The webpage is on a private network so i can't even show an example i'm afraid.

Basically there is a webpage per page server, there are 40. I go to each url, enter the log on details, the page is displayed, i shut down and move onto the next webpage and repeat.

I have seen loads of vba code to enter passwords however these only seem to deal with webpages that load and have a logon box on the page, not one that asks for credentials, through a new window, before it completes the page load.

Anyone any ideas? Completely stuck :confused:
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,891
What is this window that is asking for the login credentials? Is it an IE window? A Javascript window? Is it a Windows login window or something the web server displays? Or something else? Can you find an example of the same login window on the internet?

There's code at http://visualbasic.about.com/od/standalonevb6/l/blnewieinstance.htm which uses WithEvents to handle the creation of an IE child window or new window, but it's unclear if that is what you have here.

SendKeys might work:
Code:
AppActivate "Title of the login window"
SendKeys "YourUsername"
SendKeys "{TAB}"
SendKeys "YourPassword"
SendKeys "{Enter}"
 

Inkarr

New Member
Joined
May 21, 2010
Messages
6
Thanks for the reply John.
I believe it is an IE window. It seems to work the same as a FTP server page request. ftp://ftp.applabs.com/.
The window i see isn't quite the same, in that it has fields, site, realm, username, password as in a server logon page, but it is the same as the ftp one in that it pops up before the page will complete, if correct user details are input.
 
L

Legacy 98055

Guest

ADVERTISEMENT

Probably the windows security dialogue. I don't think you can access that one with send keys or the api but I could be wrong... I'll look into later.
 

Inkarr

New Member
Joined
May 21, 2010
Messages
6
This is the description of the window that pops up when the URL is requested. I hope it makes sense?

*Window Title*
Enter Network Password
*Information in the popup box*
Please type your user name and password
Site: ******
Realm Dynamo Admin Server
User Name (This is what i need to populate)
Password (This is what i need to populate)
OK Cancel

If i input the wrong details or cancel the following msg will be displayed:
HTTP Status 401 - You have requested data that requires authorization to access. Either your authorization was rejected or you need to authenticate yourself before you proceed.
 

Inkarr

New Member
Joined
May 21, 2010
Messages
6

ADVERTISEMENT

Thanks guys. It will be the windows security dialog.
I've wrote a script in QTP that will do what i need to do but not everyone here has access to the machine or knows how to use it. I was hoping to put something together using excel vba, but it may not be possible.
 

Inkarr

New Member
Joined
May 21, 2010
Messages
6
QTP is Quick Test Professional, an automated testing tool by HP. Unfortunately it only resides on one Virtual Machine here, hence me trying to write a macro in excel that anyone here could use. QTP code is written in VB script.
With QTP being on a virtual machine that requires additional logon rights i can't call it from the excel macro
 

Forum statistics

Threads
1,136,301
Messages
5,674,963
Members
419,536
Latest member
Mohammed Jaffer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top