Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to macro to print a sheet such a way that default printer pdf should be selected,default a3 size should be printed and should close the pdf by default.
Please suggest some solution.
I have the exact sanme problem. Please help.
Devang.
Anyone who has managed to set default size to a4 yet?
Set xlobj = CreateObject("Excel.Application")
Set wrkbook = xlobj.Workbooks.Open(varExcelFile)
Set wrksht = xlobj.worksheets("Sheet1")
wrksht.PageSetup.PaperSize = 8 ' xlPaperA3 = 8
wrksht.PageSetup.PaperSize = 9 ' xlPaperA4 = 9
The printer is the user default printer or the local default printer, I don't know if there is a way to choose the printer without a prompt message, but if the macro would always be executed in frontend, there is no problem to setup a prompt message, if it should be executed in background.... I don't know.
Try this to select the printer:
xlObj.Dialogs(xlDialogPrinterSetup).Show
Use this to close the document:
xlobj.Close()
xlobj.Quit()