Solved

Getting dlgCommonDialog to work

Posted on 2004-04-02
7
1,429 Views
Last Modified: 2012-08-14
Hi Experts

I've added a CommonDialog control to my Form1, and in that form's code I've included:

Private Sub mnuFile_PageSetup_Click()
   With dlgCommonDialog
        .CancelError = True
        .DialogTitle = "Page Setup"
        .Flags = cdlPDPrintSetup
        .ShowPrinter
    End With
End Sub

I run the app and VB stops at the dlgCommonDialog line and brings up a "variable not defined" message.
Why is this and how do I fix it?

Thanks in advance
Brian
0
Comment
Question by:BrianBeck
7 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 10740161
Select Microsoft common dialog control 6.0 from Projects->components

Add the common dialog control to your form and rename dlgCommonDialog
0
 
LVL 39

Expert Comment

by:appari
ID: 10740172
did you set the name of the commonDialog to "dlgCommonDialog"? check it.

if it is named properly then is the menu is in the same form?( what i guess is may be menu is on MDI form and commondialog on mdi child. if this is the case add form name before dlgCommonDialog somthing like form1.dlgCommonDialog)
0
 

Author Comment

by:BrianBeck
ID: 10740191
Thanks EDDYKT,

Yes I've done step 1 and added the control to my form.
But how do I rename the control??  If I right-click the control, I can call up its Property page, but there doesnt seem to be a Rename function...

I'm sure there's a simple answer...much appreciated.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 39

Expert Comment

by:appari
ID: 10740302
select the control.

press function key F4

you will get one properties window. in that window the first property (name) there you set the name.
0
 
LVL 48

Accepted Solution

by:
Mikal613 earned 125 total points
ID: 10740303
Forget changing it just do thid

Private Sub mnuFile_PageSetup_Click()
   With CommonDialog1
        .CancelError = True
        .DialogTitle = "Page Setup"
        .Flags = cdlPDPrintSetup
        .ShowPrinter
    End With
End Sub

CommonDialog1 is the default name
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10740320
Private const cdlPDPrintSetup = &H40

Also maybe add this
0
 
LVL 5

Expert Comment

by:Pi7
ID: 10740340
Open the properties page window. Click on the common dialog control
In the properties page window doubl click Name , Change the Commondialog1 to dlgConnonDialog
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

862 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now