I would set the application.activeprinter to the
Distiller then print then change back (sort of what you
are doing.) Here are work we actually use the
activeprinter index to loop thru the printers until the
one we want is found then it prints. I would try that
method and see what the exact name of the printer is,
that could be the problem.
Keith
www.kjtfs.com
-----Original Message-----
I'm using Excel to create invoices for my company. I
want to then
save all the invoices to .pdf using Acrobat Distiller
using the
invoice number as the file name. Can anyone help? I've
pasted the
code I have below:
Sub PrintPDF()
'
'Keyboard Shortcut: Ctrl+p
'
'The invoice number is in cell I8. However, it is a
function, and
therefore
'can't be pasted directly. So, I just copy it to J1,
and work from
there.
Sheets("Invoice").Select
Range("I8").Select
Selection.Copy
Range("J1").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
'This just puts the active cell back onto my document
Range("D8").Select
Dim strOldPrinter As String
strOldPrinter = Application.ActivePrinter
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
ActivePrinter:="Actobat Distiller on LPT1:"
Application.SendKeys "{return}" & Range("J1")
& "{return}", True
Application.Dialogs(xlDialogPrint).Show
Application.ActivePrinter = strOldPrinter
End Sub
When I run this macro, It starts printing to my Deskjet,
and not the
Distiller.
If you can help me, please post here. Any help would be
greatly
appreciated.
.