Hello all,
I’ve got an Access form that prints an existing excel spreadsheet from a command button. I want it to prompt the user for number of copies and printer (print dialog box) but otherwise, run in the background. I accomplished this on another project I did and it was clean and worked well, but I accidentally deleted that project (oops) Now, I can’t seem to get it right. The code I have works, but it’s chunky and no dialog box. I’ve tried using the doCmd.RunCommand acCmdPrint, but can’t figure out how to tell it what file to print.
Dim xlApp as Object
Set xlApp = CreateObject("Excel.Application"
xlApp.Visible = False
xlApp.workbooks.Open "spreadsheet.xls"
xlApp.activesheet.PrintOut
xlApp.displayalerts = False
xlApp.Quit
I’ve got an Access form that prints an existing excel spreadsheet from a command button. I want it to prompt the user for number of copies and printer (print dialog box) but otherwise, run in the background. I accomplished this on another project I did and it was clean and worked well, but I accidentally deleted that project (oops) Now, I can’t seem to get it right. The code I have works, but it’s chunky and no dialog box. I’ve tried using the doCmd.RunCommand acCmdPrint, but can’t figure out how to tell it what file to print.
Dim xlApp as Object
Set xlApp = CreateObject("Excel.Application"
xlApp.Visible = False
xlApp.workbooks.Open "spreadsheet.xls"
xlApp.activesheet.PrintOut
xlApp.displayalerts = False
xlApp.Quit