View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Excel vba printout method

Hi Curtis,
PrToFileName is what your looking for.


Sub test()
Dim Output
Close
Output = "mytest.pdf"
Debug.Print Output
Sheets(1).Activate
Application.ActivePrinter = "Acrobat PDFWriter on LPT1:"
ActiveWindow.SelectedSheets.PrintOut _
Copies:=1, PrintToFile:=True, PrToFileName:="C:\Documents and
Settings\jaf\My Documents\mytest.pdf"

End Sub

--

John

johnf202 at hotmail dot com


"Curtis" wrote in message
om...
Hello all,

I've went throw all posts on vba excel printout codes and none worked.

I am using excel to create a file and i want to save it in pdf format
but dont want the popup that asks the filename to save under

here is the code that i'm using:

Application.ActivePrinter = "Adobe PDFWriter sur LPT1:"
ActiveWorkbook.SaveAs FileName:="C:\toto.xls"
ActiveWorkbook.PrintOut

I've tried specifying parameter of printout with no success

Help please
Curtis