Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

web browser object print

Status
Not open for further replies.

sunnyjassal

Programmer
Feb 19, 2003
16
US
Hello ..
I am trying to use the web browser object.
what I am trying to do is once the person loads a form it should basically print (without clicking button)the browser object .. but the problem is if i type in the following lines:


brwWebBrowser.Navigate StartingAddress

brwWebBrowser.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0

back to back
the browser does do what it is suppose to do but does not print, where as if i debug the code and go line by line the print occurs..
i am assuming that the navigator is still trying to download the page therefore printing is not avaible..how can i wait between these 2 lines so i know when to print

i tried putting in

do while brwWebBrowser.Busy
loop

but this takes me in an infinite loop.. if my guess is correct.. I just want to wait in the middle of these lines until the brower is available to print..

i tried putting this code in the documentComplete event

Dim printerBusy As Boolean
printerBusy = True
Do While printerBusy
printerBusy = brwWebBrowser.Busy
Loop

but it did not work..

any help will be appreciated..

Thanks in advance

Sunny Jassal
 

Use the WebBrowser1_NavigateComplete2 event and set your variable = true in there...
[tt]
...
Do While Wait = True
DoEvents
Loop
...
Private Sub WebBrowser1_NavigateComplete2(...
Wait = False
End Sub
[/tt]

Good Luck

 

sunnyjassal, have you read FAQ222-2244 yet? Have you had any luck in figuring this out?

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top