Login to morningstar

max3732

New Member
Joined
Nov 25, 2011
Messages
3
I'm trying to login to my morningstar account and download some of my performance history.

I'm using early binding so I have access to intellisense. What I've written goes to the page, but gives an "Automation error (Error 440)" when I try to get it to put my login info.

I have gone to "tools -> references -> shdocvw.dll" as well as microsoft internet control

Code:
Sub Morningstar()

Dim ie As New SHDocVw.InternetExplorer
Set ie = New SHDocVw.InternetExplorer
ie.Visible = True
ie.Navigate ("https://members.morningstar.com/memberservice/login.aspx")
While ie.Busy
    DoEvents
Wend
    
    
ie.Document.all("email_textbox").Value = "username@service.com"


End Sub

 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Are you sure you have referenced the email textbox properly?

That could happen if the page hasn't fully loaded.

You can keep the loop you already have but add these as well:
Code:
    Do While ie.ReadyState <> 4: DoEvents: Loop
 
    Set doc = ie.Document
 
    Do While doc.ReadyState <> "complete": DoEvents: Loop

You might not need all 3 loops but there's no harm in having them.
 
Upvote 0
Was it the Application.Wait that worked?

I've always tended to avoid that, so perhaps I've been missing something.
 
Upvote 0
Was it the Application.Wait that worked?

I've always tended to avoid that, so perhaps I've been missing something.

Yes, I just put that line in and it worked.

Now I'm running into a different problem. I'm able to login and click on the button to download my investment info as an excel file, but then the internet explorer save dialogue box opens up and I don't have a clue how to tell it to save.

I tried looking at the source, but don't see anything referring to the "save, open, or cancel" dialogue options.

Here is my code:

Code:
Sub Morningstar()

Dim ie As New SHDocVw.InternetExplorer
Set ie = New SHDocVw.InternetExplorer
ie.Visible = True
ie.Navigate ("http://portfolio.morningstar.com/RtPort/Reg/AllView.aspx#74-shownewsByTick")
While ie.Busy
    Application.Wait (Now + TimeValue("00:00:01"))
Wend
    
ie.Document.getElementById("LoginEmail").Value = "username@provider.com"
ie.Document.getElementById("LoginPwd").Value = "password"
'Application.Wait (Now + TimeValue("00:00:01"))
'ie.Document.getElementById("fakeremember").Click
ie.Document.getElementById("LogInBtn").Click
While ie.Busy
    Application.Wait (Now + TimeValue("00:00:01"))
Wend
ie.Document.getElementById("ctl00_ctl00_ctl00_BodyRegion_ViewRegion_export").Click
'ie.Navigate ("http://portfolio.morningstar.com/RtPort/Reg/AllView.aspx#74-shownewsByTick")


End Sub
 
Upvote 0
You'll need code to control the dialog box via Windows API, if you search here (for 'john w' perhaps you) you should find something.

On a different topic, I tested the code with the Application.Wait and the code I suggested.

Both worked but with the Wait it did take slightly longer.

The only reason I can think of is because DoEvents doesn't wait as long (1 second) as the Wait will on each iteration of the loop.

Probably not relevant though.
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,666
Members
448,977
Latest member
moonlight6

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