?
Solved

Getting dlgCommonDialog to work

Posted on 2004-04-02
7
Medium Priority
?
1,481 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
Independent Software Vendors: 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 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

777 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