View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Excel vba printout method

Curtis previously stated:
I'm using excel 97 sr-2 on winnt 4.0

PrToFileName was not introduced until xl2000.

--
Regards,
Tom Ogilvy


jaf wrote in message
...
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