View Single Post
  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default How to make a document 'remember' which printer.

It would of course have helped had I posted that you can get the
Listprinters routine from
http://word.mvps.org/FAQs/MacrosVBA/...lePrinters.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
I would have thought that such an experienced coder would have been
able to arrange something suitable and saved me the bother, but the
following macro in the document template (or at a pinch in the
document itself - though that raises the spectre of macro security)
will do the job. The macro intercepts the print button and looks for
the string "COLOR" in the available printers (converting to printer
names to upper case) . You can change that string to match the
printer you require for the document.
Sub FilePrintDefault()
Dim StrPrinters As Variant, i As Long
Dim sPrinter As String
Dim sNone As String
StrPrinters = ListPrinters
sPrinter = ActivePrinter
If IsBounded(StrPrinters) Then
For i = LBound(StrPrinters) To UBound(StrPrinters)
If InStr(UCase(StrPrinters(i)), "COLOR") Then
ActivePrinter = StrPrinters(i)
GoTo PrintDoc
End If
Next i
sNone = MsgBox("Required printer not available" & vbCr & vbCr & _
"Print to default Word printer?", vbYesNo, "Printer
Error")
If sNone vbYes Then
MsgBox "Print cancelled"
ActivePrinter = sPrinter
Exit Sub
Else
GoTo PrintDoc
End If
Else
MsgBox "No printers found"
End If
Exit Sub
PrintDoc:
MsgBox "Printing to " & ActivePrinter
ActiveDocument.PrintOut
ActivePrinter = sPrinter
End Sub



ThomasAJ wrote:
You cannot do this. If each document "remembered" a specific
printer, it would cause problems when the document went to another
person.


Rubbish! If 'remembered' printer is not present then Word would use
the default printer. It might be called a 'Preferred Printer' and
reside in OPTIONS. A 5 minute programming exercise is all it would
have taken.

OK so make that 10 minutes of coding.

Very disappointing ommision by MS.

I've been coding since about '75 so I know what I am talking about.

In article ,
says...
We have many printers. How do I make a document remember which
printer it should use when the print icon is clicked on.

Sure I can use the printer drop-down box but I want certain
documents to remember their own 'default printer'.


You cannot do this. If each document "remembered" a specific
printer, it would cause problems when the document went to another
person.

--
Peter Aitken
Author, MS Word for Medical and Technical Writers
www.tech-word.com