PDA

View Full Version : [SOLVED] Popup blocking my Progress



bradedi
07-27-2005, 03:53 AM
Good Morning. I have found that searching this website when I get stuck on a problem to be very helpful. However, I have a problem that I can't seem to find an answer to and decided I should post it.

I am working in Excel 2003 and I am trying to pull various stock data from a Free website that is password protected. Below is the code I am using to input the login and password (thanks to some help on this website). My problem arises with a pop up window asking me if I want to continue to a nonsecure website. I have tried various strategies to click yes, but nothing seems to work. Does anyone have any ideas? Can this be done or should I just forget it?


Sub ReutersPassword()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
Dim webbk As Workbook
Dim webrng As Range
Dim webFwdPE As Range
With ie
.navigate "https://secure.reuters.com/login/login.aspx?go=http%3a%2f%2fwww.investor.reuters.com%2fMG.aspx%3fticker%3dGE %26target%3d%252fstocks%252ffinancialinfo%252fratios%252fvaluation&title=Free+membership+is+required+to+view+the+Ratios+report."
Do While .busy: DoEvents: Loop
Do While .readystate <> 4: DoEvents: Loop
With .Document.Forms("Form1")
.EmailAddress.Value = "asdf@yahoo.com"
.Password.Value = "asdf"
SendKeys "{ENTER}", True
End With
.Visible = True
End With
End Sub

My ultimate goal is to be able to download specific information on a list of stocks from this website for a project I am working on. I have used Yahoo!Finance, but this site has much more detailed information, which I need for this project.

ANY help would be greatly appreciated. HAVE A GOOD DAY!

Bob Phillips
07-27-2005, 07:09 AM
Step through the code, see where it gets to when the box pops up, and throw in another Sendkeys



SendKeys "{ENTER}", True

Zack Barresse
07-27-2005, 08:18 AM
From IE | Tools | Internet Options | Security | Custom Level .. then set those Miscellaneous options which you'd like. Most should be able to get set at Enable. The one you're looking for would be on Prompt.

bradedi
07-27-2005, 10:01 AM
Thanks for you both for your help. Unfortunately, neither of those suggestions seem to accomplish what I need.

MOS MASTER
07-27-2005, 10:09 AM
Hi and Welcome to VBAX! :hi:

If you are interested in Table data on that site then Why are you not using:

Data | Get External Data | New Web Query.

If you have 2002 or higher the wizard is very easy to follow and you can mark the data you like and import it in your sheet.

The benefit is speed and reliabillity as well as refreshing the data very quickly!

Just try it out.

HTH, :whistle:

bradedi
07-27-2005, 10:41 AM
Mr. MOS,

Thank you for responding. I have tried that and the problem lies in that I share this file with others. When someone else opens it on their computer, it will not work. Now it is entirely possible I am entering the code incorrectly.

What would the .savepassword field need to be? TRUE/FALSE?

MOS MASTER
07-27-2005, 11:06 AM
Hi, :yes

Just call me Joost!

This works for me to get in:


Option Explicit

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub ReutersPassword()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
Dim webbk As Workbook
Dim webrng As Range
Dim webFwdPE As Range
With ie
.navigate "https://secure.reuters.com/login/login.aspx?go=http%3a%2f%2fwww.investor.reuters.com%2fMG.aspx%3fticker%3dGE %26target%3d%252fstocks%252ffinancialinfo%252fratios%252fvaluation&title=Free+membership+is+required+to+view+the+Ratios+report"
Do While .busy: DoEvents: Loop
Do While .readystate <> 4: DoEvents: Loop
With .Document.Forms("Form1")
.EmailAddress.Value = "asdf@yahoo.com"
.Password.Value = "asdf"
.all("_ctl5").Click
End With
.Visible = True
Sleep 7000&
SendKeys "{ENTER}", True
End With
End Sub


Play with the "Sleep 7000&" part! (Depends on the speed of your connection)

Not pretty but it works.
HTH, :whistle:

bradedi
07-27-2005, 11:14 AM
:beerchug:

Joost -- This WORKS GREAT!!!!

I am still trying to learn VBA and had no idea about Sleep. Thank you! I owe you one!

Have a great day!

MOS MASTER
07-27-2005, 11:18 AM
:beerchug:

Joost -- This WORKS GREAT!!!!

I am still trying to learn VBA and had no idea about Sleep. Thank you! I owe you one!

Have a great day!

Hi, :yes
You're Welcome! :beerchug:

FYI the Sleep Function is a API (Application Program Interface) Function. You can call them from VBA but they are not part of VBA.

Don't forget to mark your thread solved!

HTH, :whistle: