Hi,
I am trying to automate the steps required to convert a worksheet into a pdf document. I am using the following code. The code works fine if I eliminate ?prtofilename:=Filename? from the parameters for the Printout method. But then a print dialog box pops up, where I have to enter a filename for the file being saved. I want to avoid this step. I tried different ways but couldn?t achieve this. Could you suggest a solution?

Sub print_macro()
 
Dim Filename As String
Filename = "c:\ABC.pdf"
 
Application.ActivePrinter = "CutePDF Writer on CPW2:"
 
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
  "CutePDF Writer on CPW2:", PrintToFile:=False, Collate:=True, prtofilename:=Filename
 
End Sub
System: Windows XP
Excel 2003 Sp2

Thanks,

MG.