Solved

Printer Common Dialog/Flags

Posted on 1997-08-25
1
350 Views
Last Modified: 2006-11-17
How do you use the constants (ex. cdlPDAllPages, cdlPDPageNums) to return the value of the print common dialog box after the user presses OK? I need to know whether the user has selected All Pages, a page range, or just a selection, etc.
0
Comment
Question by:Raven76
1 Comment
 
LVL 3

Accepted Solution

by:
ChrisLewis earned 50 total points
ID: 1432191
It's simple,

After calling CommonDialog1.ShowPrinter, get the properties of the CommonDialog1 control:

CommonDialog1.ShowPrinter      ' display Printer common dialog box.
iCopies= CommonDialog1.Copies
ifrom = CommonDialog1.FromPage
iTo = CommonDialog1.ToPage

To get the values of the Flag property, use a bitwise and to read the state of the option button.

CommonDialog1.Flags = cdlPDAllPages Or cdlPDSelection
CommonDialog1.ShowPrinter
If CommonDialog1.Flags And cdlPDSelection Then
  MsgBox "Selection"
Else
  MsgBox "All Pages"
End If


Hope this helps

Chris
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question