Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print from Preview Without Print Dialog 1

Status
Not open for further replies.

maxhugen

Programmer
May 25, 2004
498
AU
Does anyone know of a way to print a report that has been opened in Preview mode - but Hidden - using VBA?

I'm using a function to output a report to a pdf file, in the process specifying the report name and the path it's to be saved to.

However, I need to get the report's caption, as it is set dynamically on the report's Open event - the caption includes some parameters.

So I'm opening the report in Preview (windowmode=Hidden), and getting the report's caption.

However, when I use ...
Code:
DoCmd.RunCommand acCmdPrint
... I get the Print Dialog, which I don't want, as it should be output automatically by the function to the pdf file.

Other than that, the function works AOK, just can't seem to avoid the unwanted Dialog box.

Any ideas pls?

MTIA

Max Hugen
Australia
 
You might be able to use DoCmd.PrintOut instead of RunCommand acCmdPrint

I haven't tried it myself so not sure whether it will do what you want.

Andy
 
Thanks Andy

Had to open the report in windowmode:Normal (ie visible), so it could have the focus, and then DoCmd.PrintOut worked fine, without the dialog box.

Max Hugen
Australia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top