Message 1 of 7
CommonDialog - ShowPrinter
Not applicable
11-18-2005
03:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Does enyone know why "Page Setup" dialog does not return the right PaperSize
and the Orientation that user changes. Here is the code:
Private Sub Command1_Click()
On Error Resume Next
With Printer
MsgBox "DeviceName:" & vbTab & .DeviceName & vbLf & _
"PaperSize:" & vbTab & .PaperSize & vbLf & _
"Orientation:" & vbTab & .Orientation
End With
With CommonDialog1
.CancelError = True
.Flags = cdlPDNoSelection + _
cdlPDPageNums + _
cdlPDDisablePrintToFile + _
cdlPDPrintSetup ' + _
cdlPDNoWarning
.ShowPrinter
If Err Then
If Err.Number = 32755 Then
Exit Sub
Else
MsgBox Err.Number & " : " & Err.Description
End If
End If
End With
With Printer
MsgBox "DeviceName:" & vbTab & .DeviceName & vbLf & _
"PaperSize:" & vbTab & .PaperSize & vbLf & _
"Orientation:" & vbTab & .Orientation
End With
End Sub
and the Orientation that user changes. Here is the code:
Private Sub Command1_Click()
On Error Resume Next
With Printer
MsgBox "DeviceName:" & vbTab & .DeviceName & vbLf & _
"PaperSize:" & vbTab & .PaperSize & vbLf & _
"Orientation:" & vbTab & .Orientation
End With
With CommonDialog1
.CancelError = True
.Flags = cdlPDNoSelection + _
cdlPDPageNums + _
cdlPDDisablePrintToFile + _
cdlPDPrintSetup ' + _
cdlPDNoWarning
.ShowPrinter
If Err Then
If Err.Number = 32755 Then
Exit Sub
Else
MsgBox Err.Number & " : " & Err.Description
End If
End If
End With
With Printer
MsgBox "DeviceName:" & vbTab & .DeviceName & vbLf & _
"PaperSize:" & vbTab & .PaperSize & vbLf & _
"Orientation:" & vbTab & .Orientation
End With
End Sub