close

I am trying to set up a print macro which automatically print to a
pre-selected printer and not the one set as default on the computer.

The default printer needs to be set back to the one it was on for that user.

I have come up with the following code for doing this but when another user
tries to print it comes up with an error, I have worked out that it is the
Ne02 ref, on there computer it is Ne03.

The Ne ref seems to be the number that the computer give the network printer
in order they are installed on the computer, unfortunately if you were to
delete a printer and restart your computer these ref update and may change.

All I am after is a piece of code that will search for the Ne number for the
HP Laserjet 2100 PCL6 printer (To replace Ne02).Dim STDprinter As String
STDprinter = Application.ActivePrinter
Application.ActivePrinter = quot;HP LaserJet 2100 PCL6 on Ne02:quot;

ActiveWindow.SelectedSheets.PrintOut Copies:=1

Application.ActivePrinter = STDprinter
Any help will be appreciated

Stephen
Apparently VBA doesn't allow you to iterate/enumerate through the
available printers. See this link...

word.mvps.org/FAQs/MacrosVBA/...lePrinters.htm--
JWM6
------------------------------------------------------------------------
JWM6's Profile: www.excelforum.com/member.php...oamp;userid=33413
View this thread: www.excelforum.com/showthread...hreadid=532262
then I find this....

Try:
'It saves the current printer name, prompts you to select an installed
'Printer, Prints and then restores the old printer.

strOldActivePrinter = Application.ActivePrinter
Application.Dialogs(9).Show
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.ActivePrinter = strOldActivePrinterAlso you can get the new printer that was selected through these calls

Application.Dialogs(9).Show
newPrinter = Application.ActivePrinter--
JWM6
------------------------------------------------------------------------
JWM6's Profile: www.excelforum.com/member.php...oamp;userid=33413
View this thread: www.excelforum.com/showthread...hreadid=532262Thanks for the reply but i was trying to find a way to automatically select a
printer and print without the user having any input.

quot;JWM6quot; wrote:

gt;
gt; then I find this....
gt;
gt; Try:
gt; 'It saves the current printer name, prompts you to select an installed
gt; 'Printer, Prints and then restores the old printer.
gt;
gt; strOldActivePrinter = Application.ActivePrinter
gt; Application.Dialogs(9).Show
gt; ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
gt; Application.ActivePrinter = strOldActivePrinter
gt;
gt;
gt; Also you can get the new printer that was selected through these calls
gt;
gt; Application.Dialogs(9).Show
gt; newPrinter = Application.ActivePrinter
gt;
gt;
gt; --
gt; JWM6
gt; ------------------------------------------------------------------------
gt; JWM6's Profile: www.excelforum.com/member.php...oamp;userid=33413
gt; View this thread: www.excelforum.com/showthread...hreadid=532262
gt;
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()