Solved

use vbscript to call the print dialog box

Posted on 2007-11-15
4
5,386 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

744 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

11 Experts available now in Live!

Get 1:1 Help Now