Solved

use vbscript to call the print dialog box

Posted on 2007-11-15
4
5,409 Views
Last Modified: 2012-08-13
I'm very new to VBScript and need to use it to create a button on the IE Toolbar that invokes the print dialog box. The existing print button in IE just prints directly to the printer with out letting users select quantity, printer, etc. I know how to add a button to the toolbar, but I'm stumbling on the vbscript to open the print dialog box.

And no, the users can't use File/Print -- the entire File menu has been disabled. And I can't add the Print Preview to the Toolbar for other reasons.

So my question is: what's a simple vbscript to open the print dialog box?
0
Comment
Question by:DMSerley
  • 2
4 Comments
 
LVL 1

Expert Comment

by:vpt-inc
ID: 20291244
Put window.print() in the onclick event of your button.  This will pop up the print dialog box to enable the user to choose which printer, pages, etc.
0
 

Author Comment

by:DMSerley
ID: 20291278
good idea, but its not quite what I need.

window.print() works if the button is in the html, but mybutton is on the toolbar, so I have to call to an exe, bat or vbs.
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 50 total points
ID: 20292184
Hi, try this in your VBS file:

'=======
' First create an Exec menu item in IE by following this article:
'http://msdn2.microsoft.com/en-us/library/aa753591.aspx

Set objShell = CreateObject("Shell.Application")
Set objIE = objShell.Windows.Item

objIE.Document.ParentWindow.Print
     
Set objIE = Nothing
Set objShell = Nothing
'=======

Regards,

Rob.
0
 

Author Closing Comment

by:DMSerley
ID: 31409347
perfect!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Several part series to implement Internet Explorer 11 Enterprise Mode
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now