View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson[_2_] Myrna Larson[_2_] is offline
external usenet poster
 
Posts: 124
Default Automating printing to PDF

If that's your actual code, one of the arguments is misspelled. It's PrintToFile (two T's), not
printofile. With named arguments, you use a colon and equal sign (:=) not an equal sign, and
you don't need to supply commas for missing arguments.

That said, the following syntactically correct statement did not work after I set the default
printer to the "Adobe PDF" printer (I have Acrobate 6, and the printer name is different).

ActiveWindow.SelectedSheets.PrintOut PrintToFile:=True, prtofilename:="c:\test.pdf"


On 14 Jul 2003 11:00:01 -0700, (Steve Stewart) wrote:

The printer is definitely not misspelt, in fact when the macro is run
the print job icon appears in the bottom right of the taskbar as you'd
expect.

The line of code that is causing the problem is:

ActiveWindow.SelectedSheets.PrintOut , , , , , printofile = True _
, , prtofilename = "c:\test.pdf"

I don't think the PDF converter is being used properly. Somebody has
suggested that I cannot use 'prtofilename' to get the desired effect
but I don't know of any other way of achieving the same result as my
macro 'should' do.

If anyone can help it would be much appreciated :)

TIA,

Steve S



Dave Peterson wrote in message ...
I don't have a pdf printer, but I could get a 1004 error by misspelling the name
of the printer. Did you type it or did you steal the code generated when you
did recorded a macro?

Any chance it's that simple?

If not, what line of code caused the error?