Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Raising a "File Open" dialog box

Status
Not open for further replies.

mstuehler

Programmer
Jul 12, 2004
1
US
After searching this list, I've learned that you supposedly can create a standard windows "Open File" dialog window using:

Set objDialog = CreateObject("MSComDlg.CommonDialog")

However, when I tested this on a WinXP box, it doesn't work.

After more research, I came across this:

Set objDialog = CreateObject("UserAccounts.CommonDialog")

This works on XP, but it firsts prompts a ActiveX security warning, and I don't know if it works on Win98 or Win2k.

Is there a standard function that works on all WinOS?

Many thanks in advance!

Cheers to all!

 
If inside an html or hta page, you may consider something like this (from Veep in Thread329-696121):
<input type="file" name="myFile" value="Browse for File">

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I sent in a FAQ answer for this, expect it to be approved and linked to this post soon.

Short answer though in case you can't wait. :)

Add a line after what you have that reads:

Set SomeVariable = objDialog.ShowOpen

The value in "SomeVariable" will be the TRUE/FALSE result of the dialog event. IE: did the user select a file.

Your file name will exist in: objDialog.Filename
 
The FAQ got approved already. It's at faq329-5310 and I'll try to add a few more things later on that might benefit others.

Nathan aka: zaz (zaznet)
zaz@zaz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top