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

Print from vb script.

Status
Not open for further replies.

Print

Programmer
Feb 24, 2001
1
GB
HI! Do enyone know how can I print from VB script?
Thanks!
 
Yep. Here are examples in both vbscript and javascript (js will work with both IE and NN). If you are dynamically creating your documents with document.write then you will need to precede you write statements with document.open() and close them with document.close() (Ex. d.o()...d.w...d.w...d.w...d.c())

Code:
<html>
<head>
<script language=&quot;vbscript&quot;>
Sub PrintIt
 window.print()
End Sub
</script>
<body>
This is some info<br><br>
<input type=button onClick=&quot;PrintIt&quot; value=&quot;Print&quot;>
</body>
</html>

<html>
<head>
<script language=&quot;javascript&quot;>
function PrintIt(){
 window.print()
}
</script>
<body>
This is some info<br><br>
<input type=button onClick=&quot;PrintIt()&quot; value=&quot;Print&quot;>
</body>
</html>

Hope this helps,
[sig]<p>Rob<br><a href=mailto:robschultz@yahoo.com>robschultz@yahoo.com</a><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
"Focus on the solution to the problem,<br>
not the obstacles in the way."<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top