PDA

View Full Version : [SLEEPER:] Print PDF



chungtinhlak
06-19-2009, 09:56 AM
I have to print multiple files to PDF each day to the same directory each day. Is there a way to code this. I was able to do a record macro to get the print function, how do I aim it to go to a directory with file names to save? Thank you for you help.



Application.ActivePrinter = "Adobe PDF on Ne02:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne02:", Collate:=True

franklab
06-19-2009, 11:26 AM
here what i did for one of my xls macro:


Public Sub PrintToAnotherPrinter()
ne_search
sFileName = "c:\test.pdf"
If Application.ActivePrinter Like "Adobe*" Then
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=Application.ActivePrinter Like "Adobe*", Collate:=True
Else
' Choose printer
Application.Dialogs(xlDialogPrinterSetup).Show
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=Application.ActivePrinter, Collate:=True
End If
Debug.Print Application.ActivePrinter
End Sub

Public Sub ne_search()
Dim ne As String
Dim printer
Dim i%
printer = "Adobe PDF on Ne"
On Error Resume Next
For i = 1 To 99
ne = VBA.Format(i, "00")
Err.Number = 0
Application.ActivePrinter = printer & ne & ":"
If Err.Number = 0 Then
Exit For
End If
Next
End Sub