?
Solved

use vbscript to call the print dialog box

Posted on 2007-11-15
4
Medium Priority
?
5,686 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 200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
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…

850 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