PDA

View Full Version : PrintToFile Problem



MWE
02-24-2016, 08:39 PM
I am (still) running xl2003. I am trying to print out (under VBA control) the contents of a worksheet as a pdf file. I have set the defualt printer to the pdf engine I use (Nitro) and the output looks OK. However, I can not get the output file name to be what I want. I have tried two versions of the printout statement (FileName has been set to the fully qualified output file name; xlcertif is the active sheet)

ActiveWindow.SelectedSheets.PrintOut Copies:=1, PrintToFile:=True, PrToFileName:=FileName

xlcertif.PrintOut Copies:=1, PrintToFile:=True, PrToFileName:=FileName

No matter what I use for FileName, I am presented with a window suggesting that the output file name should be the ActiveWorkBook name with the correct .pdf extension.

Any thoughts?