Solved

use vbscript to call the print dialog box

Posted on 2007-11-15
4
5,492 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

733 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