Okay, I finally have found something that might work for you, keeping in mind manarth's comment that this script may one day be considered unsecure and a patch will keep it from working.
In the meantime, this does seem to work, even though I don't fully understand why or how, but I have tested it and gotten it to work.
Here it is:
Code:
<script Language="vbscript">
Sub PrintPage()
Dim objIEA
Set objIEA = CreateObject("InternetExplorer.Application")
objIEA.Visible = True
objIEA.Navigate "[URL unfurl="true"]http://www.myserver.com/myreports.asp?var1=A&var2=B&var3=C"[/URL]
While objIEA.Busy
Wend
objIEA.ExecWB 6,2
Set objIEA = Nothing
End Sub
</script>
Some side notes
The .Navigate line must have the full URL or it wont work. You'll want to change it to an actual URL before you test it.
.Visible must equal True, I tried setting it to false and all it does is put the new browser window behind the others and therefore is not active and therefore can't make the call to ExecWB which is what prints the web page.
If you change 6,2 to 6,1 -- you will get the print window, the 2 bypasses the print window.
The While loop keeps the page from printing until it has loaded.
Yes, this does open a new window (haven't figured out how to get this to work in the current window) and outside of some javascript that tells the window to close which then asks the user if he/she wants to close it, I haven't figured out any other way to close it. You could do a redirect in the new window to a page that tells the user to close it, or possibly just hide the window by adding a .Visible = False before you set the object to nothing.
Don't forget you have to make a call to this script, a submit button would work. I'm assuming you are sending variables to the report page so it knows what to print, so you may want to put this script in an intermediate page to build the URL in ASP for the navigation line.
If anyone has found something better (preferably free) let me(us) know.
If you have any questions, I'll see if I can help, but most of what I learned is in this post.
In the meantime, good luck and hope this helps,
TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner