Tuesday, July 28, 2015
How to Script Printer Settings (5 Steps)
Click the Windows 'Start' button on your network server. Type 'notepad' in the search text box and press 'Enter.' The text editor opens. You can also create VBA scripts on the local computer. Any Windows operating system runs VBA scripts.
Create a connection to the printer. You cannot create settings without first making a network connection to the printer. The following code shows you how to make a printer connection:Set network = CreateObject('WScript.Network')printer = '\computer\Printer'network.AddWindowsPrinterConnection printernetwork.SetDefaultPrinter printerReplace '\computer\printer' with the name of the computer where the printer is attached and the printer's name. This code makes a connection to the printer and loads the drivers on the user's computer.
Set up the printer's configurations. Several options exist for printer setups. For instance, if you want to center a page's content and set up the printer to print in landscape, use the following code to set up the page orientation:ActiveSheet.PageSetup.CenterHorizontally = TrueActiveSheet.PageSetup.Orientation = xlLandscape
Press 'Ctrl+S' to save the changes. Since this is a new VBA file, the 'Save As' dialog window opens. Type a name for your script, and type '.vbs' at the end of the file name. The 'vbs' file extension tells Windows that the file executes as VBA. Otherwise, Windows opens the file as a text file.
Double-click the file on the desktop to test the VBA code. The file maps a printer to the printer device you specified in Step 2 and sets up the page settings on your computer.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment