Print Excel Sheet from Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In access I created a form. From this form you can call a VBA code which
creates an Excel sheet from a query. The Excel sheet is made vissible using
the following code: xlApp.Visible = True

Which VBA code do I have to add to print the Excel sheet? And after the
sheet is printed, which code do I have to add to close the Excel application?

Thanks in advance,

JeroenM.
 
Hi,

whateveryourobject.PrintOut

should do the printing

whateveryourobject.Quit

as a tip, when writing automation applications, go into the automated
application and record a macro, do the functions you are trying to automate,
then stop the recording of the macro, then view the macro code, this idea
works excellently for word and excel.
 
Brilliant! Duh, here I have been scouring manuals, Help files, and the
object browser looking for correct COM syntax. This is one of those where
you say to yourself, that is so obvious I am stupid for not thinking of it.
Thanks
 
Back
Top