How to use common dialog without placing the ocx control on the form

joyrider used Ask the Experts™

i made this small function that will set the backcolor of a picturebox to the color selected in the color selector dialog of common dialogs. Now i used the common dialog control and have set it on my form, but i need to use this function in multiple forms, and i can't seem to find out how i can use commondialog without using the component , i mean without putting it on the form and using that one. So how can i do this ? (referencing)
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

is the control on a form thats always available/loaded ? If so simply call to it.

for example, if your using an mdi setup, you'd put the CommonDialog control on the mdi form so that it'd be


then you'd just use it like from form1

pubic sub form1_load()
end sub


that's not what i was looking for, u would still have to use the control, but i found it myself

it's :
dim cmdialog as object
Set cmDialog = CreateObject("MSComDlg.CommonDialog")

that's what i was looking for :)

omg, im tired as hell, spent the past few hours posting in sql and db, lol
question will be moved to PAQ and points refunded in 72 hours, if no other comment regarding closure is made

as per request here

Jgould-EE Moderator

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial