Could somebody (Graham?

) please tell me where I am going wrong with the syntax in this snippet:
Code:
curPtr$ = Application.ActivePrinter
Application.ActivePrinter = "Microsoft Print to PDF"
ActiveDocument.PrintOut False, False, 0, txtFilename, 0, 0, 0, 1, 0, 0, True
Application.ActivePrinter = curPtr$
The intention is clearly to print the whole of the current document to a .pdf file, given the name in txtFilename, but I just get a 'type mismatch' error on the third line.
Phil