vba - Print macro using xlDialogPrinterSetup fails to use driver-specific settings -
vba - Print macro using xlDialogPrinterSetup fails to use driver-specific settings -
i have piece of vba code prints set of sheets if criteria on sheet containing code , command button met.
sub printer() dim rnsheets range dim rnsheetname range dim mycell range dim snameadress string dim fname string dim ws worksheet snameadress = "i10" set rnsheets = me.range("c12:c39") application.screenupdating = false on error resume next 'denna rad ger ett fel om skrivaren inte finns, därav inneslutning av felhanterare. 'kanske felet bör hanteras? application.activeprinter = "gotatunneln-04 på ne02:" on error goto 0 'tar upp skrivardialog. application.dialogs(xldialogprintersetup).show 'application.dialogs(xldialogprint).show each mycell in rnsheets if mycell <> "" set rnsheetname = mycell.offset(0, -2) on error resume next set ws = worksheets(rnsheetname.text) on error goto 0 if ws nil msgbox "kan ej hitta arbetsblad med namn " & rnsheetname, vbexclamation, "fel!" else ws 'med en skillnad. .printout 'alternativt, bara för att vara säker... '.printout activeprinter:="gotatunneln-04 på ne02:" end end if end if next mycell application.screenupdating = true end sub
however, each of printed sheets consists of 3 pages , designated printer has built in stapler much staple printouts otherwise have manually.
even though xldialogprintersetup dialog allows me take settings printer (driver-specific settings is), settings not applied.
why , how proceed?
thanks in advance!
vba excel-vba
Comments
Post a Comment