Solved

Getting dlgCommonDialog to work

Posted on 2004-04-02
7
1,452 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

733 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