Display and Print web site

B

Breecy

Good evening all,
I have looked through several message boards and have not found an answer on
my problem. I would like to loop through opening a website and having it
print the website after it displays. I want to get stock prices off of yahoo
for instance and change the last few characters to the stock prices I need.
Example:

The website address is: http://finance.yahoo.com/q?s=wal. I have several
tickers that I want to look up. The logic would flow like this:

Assign recordset
Do until EOF
go to first record
create website string: "http://finance.yahoo.com/q?s=" & stockname
open website
Print
Loop

Thanks a bunch in advance for any help.
 
B

Breecy via AccessMonster.com

Is there a website that you would recommend for leaning about the web browser
control?
 
B

Breecy via AccessMonster.com

O.K. so I have most of it, but I have to put in a msgbox to allow for the
appliction to catch up with itself to print. I have tried a timer and I have
tried a do events and neither of these seems to help. Any suggestions? code
is below:

Private Sub cmdPrint5PAll_Click()
Dim rsADOLoop As ADODB.Recordset
Dim strTS As String 'Ticker Symbol
Dim strWSS As String 'Web Site Sting
Dim strCusip As String
Dim intCount As Integer

Set rsADOLoop = New ADODB.Recordset
rsADOLoop.Open "tblFormat5Percent", CurrentProject.Connection, adOpenDynamic,
adLockPessimistic
With rsADOLoop
rsADOLoop.MoveFirst
Do Until rsADOLoop.EOF
strTS = Nz(rsADOLoop.Fields("Ticker Sym").Value, "")
If strTS <> "" Then
strWSS = "
http://activequote.fidelity.com/webxpress/get_quote?QUOTE_TYPE=&SID_VALUE_ID
=" & strTS
PrintWebSite strWSS
Else
strCusip = rsADOLoop.Fields("Cusip").Value
strWSS = "
http://activequote.fidelity.com/mmnet/SymLookup.phtml?" & _
"QUOTE_TYPE=&scCode=E&searchBy=C&searchFor=" & strCusip
Application.FollowHyperlink strWSS, , True
End If
rsADOLoop.MoveNext
Loop
End With

rsADOLoop.Close
Set rsADOLoop = Nothing
MsgBox "Processing is complete!"
End Sub

Function PrintWebSite(WebPage As String)
Dim ie As Object
Dim intwidth As Integer
Const OLECMDID_PRINT = 6
Const OLECMDEXECOPT_PROMPTUSER = 1
Const OLECMDEXECOPT_DONTPROMPTUSER = 2

Set ie = CreateObject("InternetExplorer.Application")
'************************ Another option = Application.FollowHyperlink
strWebPage, , False
ie.navigate WebPage
Do Until ie.busy = False
DoEvents
Loop
'Send Data to IE

'Prints without showing the user that the browser is open.
ie.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
MsgBox "I printed"
' Do While ie.readystate <> 4
' DoEvents
' Loop
'
'Giving it time to print but still need msgbox....
ie.Quit

Set ie = Nothing
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top