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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open specific web page with IE, then print and close. 1

Status
Not open for further replies.

JMCONNOR

Technical User
Feb 16, 2006
16
0
0
US
I have a module that successfully opens IE and brings up the desired web page. What I need to do now is print the page to the default printer and close IE from within the module. The user never even needs to see the page on the screen.

The pertinent lines:
Code:
Set IE = CreateObject("internetexplorer.application")
With IE
    .Navigate strURL (where strURL = the page's url)
    rem put print here
    rem close IE
 
Dim IE
Set IE = CreateObject("internetexplorer.application")
With IE
.Navigate " Do Until IE.ReadyState = 4 'READYSTATE_COMPLETE
DoEvents
Loop

.ExecWB 6, 2, 2, 0 'OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,PRINT_WAITFORCOMPLETION,0

.Quit
End With
Set IE = Nothing

---------------------------------------
Bob Beck
Systems Administrator
 
Thanks, This works beautifully. I have a couple projects That will benefit from this.

 
You're welcome. I can't take credit for it, though. I found it on the internet a few years ago for another app I was working on.

In any case, I'm glad it I could help.

---------------------------------------
Bob Beck
Systems Administrator
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top