Accessing HTTPS file using Login details via VBA

lopiteaux

Board Regular
Joined
Jun 8, 2011
Messages
77
New thread started per Norie's request...

To summarise my problem, I have to retrieve a file from a https encrypted site every day. The steps needed are as follows (kudos to doubledaffy):
  1. Open link
  2. If login is necessary do so.
    • This requires inputting a Username and Password and simulating a "click" on the "GO" button
    • Also need to select from the dropdown menu (which is do-able)
  3. Navigate to the next page
  4. Access the link for the correct page to download.
  5. Afterwards the VBA will save down the file in a specified folder and perform various analyses on the data - this part I already have.
Links are as follows:

Website/login: https://www.theice.com/homepage.jhtml?loginApp=ICE
Next page (containing link to file): https://www.theice.com/dashboards/ClearEuropeDashboard.shtml
File: https://www.theice.com/dashboards/clear_europe/securedocs/IDR_rates_USD_GBP_EUR.xls

@Norie, to answer your questions on the previous thread (http://www.mrexcel.com/forum/showthread.php?t=319342&page=4), the dropdown box is on the first login page, right above the boxes containing the Username and Password, and from this dropdown list I need to select "Clear EU Dashboard". I know this is really difficult to test on your end due to the lack of login details guys, but unfortunately the information is a little sensitive for me to post these on this forum.

Thanks again for all the continued help.

l<!-- / message -->
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
lopiteaux

Are you saying the dropdown part has already been done?
 
Upvote 0
Nope - when the site is first opened you have to:
  1. Select "Clear EU Dashboard" from the dropdown;
  2. Input Username;
  3. Input Password.
Cheers...
 
Upvote 0
Try this.

It does selects the item you want, enters the password etc but I can't be sure it will work.
Rich (BB code):
Option Explicit

Sub LogIn()
Dim IE As Object
Dim doc As Object
Dim frm As Object
Dim username As Object
Dim pwd As Object
Dim drop As Object
Dim strURL As String
Dim strUserName As String
Dim strPwd As String
 
    strURL = "https://www.theice.com/homepage.jhtml?loginApp=ICE"
 
    strUserName = "YourUserName"

    strPwd = "YourPasssword"
 
    Set IE = CreateObject("InternetExplorer.Application")
 
    IE.Visible = True
 
    IE.navigate strURL
 
 
    Do Until IE.ReadyState = 4
        DoEvents
    Loop
 
    Set doc = IE.Document
 
    Set frm = doc.getelementbyid("loginForm")
 
    Set username = doc.getelementbyid("j_username")
 
    Set pwd = doc.getelementbyid("j_password")
 
    Set drop = doc.getelementbyid("loginto")
 
    drop.Value = "clearEuropeDash"
 
    username.Value = strUserName
 
    pwd.Value = strPwd
 
    frm.submit
 
    Do While IE.Busy: DoEvents: Loop

    Do While IE.ReadyState <> 4: DoEvents: Loop
 
End Sub
If it doesn't work post back with details of how.
 
Upvote 0
Try this.

It does selects the item you want, enters the password etc but I can't be sure it will work.
Rich (BB code):
Option Explicit
 
Sub LogIn()
Dim IE As Object
Dim doc As Object
Dim frm As Object
Dim username As Object
Dim pwd As Object
Dim drop As Object
Dim strURL As String
Dim strUserName As String
Dim strPwd As String
 
    strURL = "https://www.theice.com/homepage.jhtml?loginApp=ICE"
 
    strUserName = "YourUserName"
 
    strPwd = "YourPasssword"
 
    Set IE = CreateObject("InternetExplorer.Application")
 
    IE.Visible = True
 
    IE.navigate strURL
 
 
    Do Until IE.ReadyState = 4
        DoEvents
    Loop
 
    Set doc = IE.Document
 
    Set frm = doc.getelementbyid("loginForm")
 
    Set username = doc.getelementbyid("j_username")
 
    Set pwd = doc.getelementbyid("j_password")
 
    Set drop = doc.getelementbyid("loginto")
 
    drop.Value = "clearEuropeDash"
 
    username.Value = strUserName
 
    pwd.Value = strPwd
 
    frm.submit
 
    Do While IE.Busy: DoEvents: Loop
 
    Do While IE.ReadyState <> 4: DoEvents: Loop
 
End Sub
If it doesn't work post back with details of how.

Hi Norie,
I'm very new at VBA and was wondering if you new somewhere that could explain the code your describing. I need to do something very similar to what this gentleman is trying to do, but I would like to learn what it is that I'm doing rather then just ask people to do it for me. Any thoughts?
 
Upvote 0
It might be better if you start a new thread for your question and give more details.:)

You can always add a link to this one if you think it might be relevant.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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
Back
Top