|
macro to print to default printer
gotta problem.
we are remodeling our office and people are moving but the printers aren't. the problem is sw doesn't print to the default printer, it prints to whatever the drawing has for printer settings.
so, we have users across the buliding that are printing sw documents and then realize that the printer isn't next to them anymore.
so i was wondering if anyone has a macro that would print to the windows default printer?
rob jensen
southern mn solidworks user group leader
hello rob,
i believe what you are after is:
modeldoc2:: printdirect
description:
this method prints the current document to the default printer.
the macro you are after would be something in the lines:
option explicit
dim swapp as sldworks.sldworks
dim modeldoc as sldworks.modeldoc2
sub main()
set swapp = application.sldworks
set modeldoc = swapp.activedoc
modeldoc.printdirect
end sub
hope it helps
--stav.
p.s you can also use modedoc2:: printer to get or set the default printer.
in this world i am nobody...
and nobody is perfect ;) !!!
---------
solidworks office 2008 sp4.0
dell precision pws390
nvidia quadro fx 3450/4000 sdi
edited: 10/31/2007 at 05:27 am by stavros antoniou
hi, is there a way to write into the macro which printer to select? printdirect seems limited as you can't specify which sheets to print etc. we have a macro to print our drawings however would like the user running the macro to be able to specify which printer they use.
thanks, ben
hello ben,
yes there is.
have a look at
modeldoc2::printer.
description
this property gets or sets the default printer for this document.
once you set your default printer:
remarks
modeldoc2::printdirect and modeldocextension::printout2 use this setting if you pass an empty string to printer.
cheers,
--stav.
in this world i am nobody...
and nobody is perfect ;) !!!
---------
solidworks office 2008 sp4.0
dell precision pws390
nvidia quadro fx 3450/4000 sdi
edited: 12/20/2007 at 08:55 am by stavros antoniou
thanks stav,
i've worked out how to use the printout2 command, but was trying to see if there is a way to see what the printer names are that are available to print to. i basically want the person running the macro to be able to select which printer their drawings will get printed to, from a list of available printers on their computer.
is there any way to do this?
thanks, ben
for getting a list of printers, i've used enumerating printers api as describe by microsoft kb 200611. (
thanks michael,
yeah the main reason i'm needing to look into getting the list of printers is we have varying case for our printer names too.
for vb2005 i'm using this:
dim myprinter as string
cbprinter.items.clear()
for each myprinter in system.drawing.printing.printersettings.installedprinters
cbprinter.items.add(myprinter)
next
--john
quick |
|