Printer Object Problem
The first issue: for some printers, when the user selects different paper sizes it doesn't return the corrosponding value in the Printer.PaperSize property. In other programs(ie. Paint.exe) the user can select the same paper size and it does work.
The second issue: again for some printers, after the user selects a printer and chooses its settings(paper size, print quality, etc.) the printer info is saved to a file. The next time our program is started it reads the print info from the file and selects the appropriate printer and begins setting its properties(which is had previously read from the printer object) it crashes the program. I have error code to catch any errors but it still crashes. My error code saves error info to a file but that never happens. It crashes the program before the error code can catch it. Again if the same settings are done in other programs it does not crash the other programs.
The code below is from 2 separate functions. I have inserted a line of equal signs(=) separating them.
'*** SET AND SAVE PRINTER INFO ***
Dim PName As String
Dim POrientation As Integer
Dim PQuality As Integer
Dim PPaperSize As Integer
Dim PColorMode As Integer
Dim PDuplex As Integer
Dim PPaperBin As Integer
Printer.TrackDefault = True
'Show the printer setup
MainScrn.CMDialog1.Flags = cdlPDPrintSetup
MainScrn.CMDialog1.ShowPrinter
'Set the printer object to use whatever printer has been set to it
Printer.TrackDefault = False
'Save the printer settings
PName = Printer.DeviceName
POrientation = Printer.Orientation
PQuality = Printer.PrintQuality
PPaperSize = Printer.PaperSize
PColorMode = Printer.ColorMode
PDuplex = Printer.Duplex
PPaperBin = Printer.PaperBin
'*** Save the printer info to the file ***
...
End Sub
====================================================
'*** RESTORE PRINTER INFO ***
Printer.TrackDefault = False
'Set the Printer
For Each P In Printers
If P.DeviceName = PName Then
Set Printer = P
Exit For
End If
Next 'P
'Set printer info
Printer.Orientation = POrientation
Printer.PrintQuality = PQuality
Printer.PaperSize = PPaperSize
Printer.ColorMode = PColorMode
Printer.Duplex = PDuplex
Printer.PaperBin = PPaperBin
Thank you for any help.

