|
-
Sep 13th, 2000, 09:51 AM
#1
Thread Starter
PowerPoster
I am attempting to still make a custom printer dialog. On load, acombo recives all printer devices. When I call my print routine, how can I write code to use what printer the user selected. I set a Global varaiable = SelP(Selected Printer) as string, but its not working (errors)..Any suggestions?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 13th, 2000, 09:57 AM
#2
Addicted Member
Try putting this code into the cmdPrint sub or whatever you have named it
dim thisprinter as printer
private sub cmdprint
for each thisprinter in printers
if thisprinter.devicename = "" then
set printer = thisprinter
exit for
end if
next
Hope this helps you out!!
-
Sep 13th, 2000, 09:58 AM
#3
This should help:
Printers Property
Returns a Printerscollection, which enables you to gather information about all the available printers on the system.
Syntax
Printers(index)
The index placeholder represents an integer with a range from 0 to Printers.Count-1.
Remarks
The Printers collection enables you to query the available printers so you can specify a default printer for your application. For example, you may want to find out which of the available printers uses a specific printer driver. The following code searches all available printers to locate the first printer with its page orientation set to portrait, then sets it as the default printer:
Dim X As Printer
For Each X In Printers
If X.Orientation = vbPRORPortrait Then
' Set printer as system default.
Set Printer = X
' Stop looking for a printer.
Exit For
End If
Next
You designate one of the printers in the Printers collection as the default printer by using the Set statement. The preceding example designates the printer identified by the object variable X, the default printer for the application.
Note If you use the Printers collection to specify a particular printer, as in Printers(3), you can only access properties on a read-only basis. To both read and write the properties of an individual printer, you must first make that printer the default printer for the application
-
Sep 13th, 2000, 10:05 AM
#4
Thread Starter
PowerPoster
Thank you. more questions...
So once you SET the printer, as in Set Printer = thisprinter, then the printer is the associated with the one selected? I know these questions are lame, but I am trying to understand...
Also, by using SET, does this change the default on the system, or just in the application?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 13th, 2000, 10:11 AM
#5
Addicted Member
The Set will automatically goto that specific printer once it is selected. But if the user wants to select another printer then that print will become the default printer.
-
Sep 13th, 2000, 10:17 AM
#6
Thread Starter
PowerPoster
For which?
For the application or the system?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 13th, 2000, 10:19 AM
#7
Addicted Member
-
Sep 13th, 2000, 10:27 AM
#8
Thread Starter
PowerPoster
Thanks. that will help me out a great deal.
Thank you jeffro and MartinLiss. I appreciate all your help. One last question on this subject, How can you determine the system default when pooling form all installed printers? ie. I want my combobox to show all, but have the default shown first.
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 13th, 2000, 11:38 AM
#9
This should give you the default printer:
Code:
Dim Prnt As Printer
For Each Prnt In Printers
If Prnt.TrackDefault Then
'this is the default printer, add the code here...
End If
Next
-
Sep 13th, 2000, 11:45 AM
#10
Thread Starter
PowerPoster
Sc0rp : Thanks for the last post.
Thank you everyone.
See you at my next post, creating text files, coming soon.
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 13th, 2000, 12:09 PM
#11
Thread Starter
PowerPoster
prnt.Trackdefault
I copied your code into my program. the trackdefault never gets set to true after looping all printers. Why would this occur, I do have a default printer.
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|