Vista and common dialog box

Vista and common dialog box

Post by Dave » Thu, 13 Sep 2007 10:53:16

I have a VBS file that runs fine on XP but errors out on Vista. I am using
the statement:

Set dlg = CreateObject("MSComDlg.CommonDialog")

Vista doesn't seem to like it. Is there a similar thing in Vista?

Vista and common dialog box

Post by Paul Randa » Thu, 13 Sep 2007 12:36:39

The common dialog control is a licensed control. All the programs that you
purchase, or came with your computer, that use this control, were built with
a compiler/packaging system that included the license for them, but NOT for
scripts you write. Maybe someone else will post the licensing details with
correct terminology.

I have tested the following on WXP; I have no idea whether it works on

The following web page talks about an HTML editor.

It contains the following link to download the source HTA/VBScript.

If you download and install htmleditor.exe, you get a free license that
allows use of the control from script, and if you read the source code
closely, you may learn how to freely install a similar license on any
computer. You may also learn how to use the color picker and font picker
built into the common control too. The editor is an HTA application, so it
is a good way to learn about HTAs too.

I use this HTA to combine info from various web pages into a single HTML
file on my computer. I select the area, including graphics, tables, etc,
from a web page, hit Ctrl-C, than go to the HTML editor window and paste the
stuff where I want it. When I have what I want, I choose save, and the HTML
editor uses the common control to give me the save as... dialog box. When
you open the saved file in IE, the links all work and the graphics show up.
If you want the graphics to show up offline, then use IE to save as MHT
format, which will embed the graphics with the html.

-Paul Randall


Vista and common dialog box

Post by Gilles COS » Thu, 13 Sep 2007 16:16:25

"Dave" < XXXX@XXXXX.COM > writes:

You can use the LPK (Licence packaging tool). Look at

You should be ble to generate a licence file that allows your scripts
to use the Common Dialog and even download it if not already installed
on the computer.
Gilles COSTA, Gmre-expert
Arkane-foncier, Gmres-experts associ
17, grande rue, BP 23 91311 Montlhy cedex
T : - F :

Vista and common dialog box

Post by mayayan » Thu, 13 Sep 2007 22:03:41

In addition to the other answers, there's this simple
script that I think works dependably on all pre-Vista
systems. I'd be interested to know whether it works
on Vista as well. It's a little bit hokey, using IE as it
does, but it's free of dependencies.

Dim s1
s1 = ChooseFile
msgbox s1

Function ChooseFile()
Dim Q2, sRet
Q2 = chr(34)
ChooseFile = ""
Set IE = CreateObject("InternetExplorer.Application")
IE.visible = False
Do Until IE.ReadyState = 4

IE.Document.Write "<HTML><BODY><INPUT ID=" & Q2 & "Fil" & Q2 & "Type=" &
Q2 & "file" & Q2 & "></BODY></HTML>"
With IE.Document.all.Fil
sRet = .value
End With
Set IE = Nothing
ChooseFile = sRet
End Function


Vista and common dialog box

Post by Dave » Fri, 14 Sep 2007 10:39:55

Thanks for this information. I will definitely give it a whirl.

Vista and common dialog box

Post by Dave » Fri, 14 Sep 2007 10:41:53

Thanks for this information. Is there way to use a control from Microsoft
Office 2007 that would be loaded on any computer?

Vista and common dialog box

Post by Dave » Fri, 14 Sep 2007 10:42:22

I will give this a test to see how it works on Vista.

Vista and common dialog box

Post by Paul Randa » Fri, 14 Sep 2007 12:28:29

I believe that Office does not include a license for VBScript to access this
particular object included with Office.

-Paul Randall