PrinterSettings for access 2003 vba

G

gunslingor

I am trying to do something that should be fairly simply, but is killin
me.

I have a form with a subform. The main form will have things lik
"Print Selection" Button, "Printer" combo box, "Paper size combo box
"Copies" text box, and similar things one might expect in a prin
dialog box. The subform is datasheet view only and pulls it'
information from a table that lists information for associated visi
drawings stored in the a project subfolder, including filename (I kno
how to get the whole path and send it to the print and batchplo
implementation).

Here's what the user will need to be able to do:
1. the user will select items in the subform using a field calle
"print?" which is a check box
2. the user will select the print settings
3. the user will hit the "print selection" button
4. all visio drawings selected will be printed using user selecte
print settings.

Help:
1. How do I get an object or objects in vba that represents the record
selected in the subform? (CANCELED-decided to use the check box instea
of selection since you can't skip over records when selecting)
2. How do I set the combobox row source to list all printers availabl
on the working machine. Note that this project will be on many PCs, al
with different printers. (Completed-used thi
http://word.mvps.org/faqs/MacrosVBA/...lePrinters.htm)
3. How do I set the other combo row source to list all paper size
associated with the printer selected? (HELP HELP HELP)

#3
a coworker used this in VB.NET
Dim size As PaperSize
Dim Printer As New PrinterSettings
Printer.PrinterName = CB_UserPrinter.Text
CB_PaperSize.Items.Clear()
For Each size In Printer.PaperSizes
CB_PaperSize.Items.Add(size.PaperName)
Next

However VBA in access 2003 doesn't have a "size" object nor a papersiz
collection. He said he had to import a system.drawing.printersetting
class, but only a system.drawing.dll is in my references and is not a
all the right thing. Please help. All I need is a string separate
by";" that lists all paper sizes for a given printer selected.

Thanks
 
G

gunslingor

Problem Solved!!!!!!!!!!


Found solution in an example DB here (module name=modPrinter, look i
the function called "getpapersizes"):

http://msdn.microsoft.com/en-us/library/aa139946(office.10).aspx

I had to modify the getpaperssizes function so that a "printer name
string is passed as well as a "paper list" string to store it the list
Took out the msgbox command and modified the returned string (returne
via an argument, could not get the function to return directly) for us
in 2 column combobox.

Please let me know if this was helpful. It take me a week to find thi
code for some reason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top