File Open Dialog box in Vista
Hi all,
I have been using the UserAccounts.CommonDialog from XP with my VBScripts,
however this doesn't seem to work in Vista.
Does anyone know if there is a similar ActiveX object to call in Vista or
Vista specific way to call the Common File Open dialog from VBScript?
Cheers,
Pete Gomersall
Re: File Open Dialog box in Vista
Pete Gomersall wrote:
> Hi all,
> I have been using the UserAccounts.CommonDialog from XP with my
> VBScripts, however this doesn't seem to work in Vista.
> Does anyone know if there is a similar ActiveX object to call in
> Vista or Vista specific way to call the Common File Open dialog from
> VBScript? Cheers,
> Pete Gomersall
Scripting Week 3 Question and Answer Log
<http://www.microsoft.com/technet/scriptcenter/webcasts/sweek3/day4qanda.mspx>
"...
What is the best alternative to 'UserAccounts.CommonDialog' for an HTA
running on Windows 2003 server?
I assume you're looking for the File Open/File Save dialog boxes; you can
use the SAFRCFileDlg object. You can find an example of using the File Save
dialog box here:
http://www.microsoft.com/technet/scr...-found-it.mspx.
...."
....which points you to...
The Scripting Week 3 Giveaway
<http://www.microsoft.com/technet/scriptcenter/webcasts/sweek3/you-found-it.mspx>
Maybe SAFRCFileDlg will work on Vista?
--
Michael Harris
Microsoft MVP Scripting
Re: File Open Dialog box in Vista
Michael,
Thanks for comments but I get the same error as I did using
"UserAccounts.CommonDialog from XP":
ActiveX component can't create object - SAFRCFileDlg.FileSave - Code:
800A01AD
Maybe someone from MSFT may know what the correct object call for File
Open/Save dialogs in Windows Vista is from VBScript?
Many thanks though,
Pete Gomersall,
"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:%23%23vgJkq3GHA.5000@TK2MSFTNGP02.phx.gbl...
> Pete Gomersall wrote:
>> Hi all,
>> I have been using the UserAccounts.CommonDialog from XP with my
>> VBScripts, however this doesn't seem to work in Vista.
>> Does anyone know if there is a similar ActiveX object to call in
>> Vista or Vista specific way to call the Common File Open dialog from
>> VBScript? Cheers,
>> Pete Gomersall
>
> Scripting Week 3 Question and Answer Log
> <http://www.microsoft.com/technet/scriptcenter/webcasts/sweek3/day4qanda.mspx>
>
> "...
> What is the best alternative to 'UserAccounts.CommonDialog' for an HTA
> running on Windows 2003 server?
>
> I assume you're looking for the File Open/File Save dialog boxes; you can
> use the SAFRCFileDlg object. You can find an example of using the File
> Save dialog box here:
> http://www.microsoft.com/technet/scr...-found-it.mspx.
> ..."
>
> ...which points you to...
>
> The Scripting Week 3 Giveaway
> <http://www.microsoft.com/technet/scriptcenter/webcasts/sweek3/you-found-it.mspx>
>
> Maybe SAFRCFileDlg will work on Vista?
>
> --
> Michael Harris
> Microsoft MVP Scripting
>
>
Re: File Open Dialog box in Vista
hey, i'v got a way to resolve this problem. Please try the code below:
on error resume next
set fso=createobject("scripting.filesystemobject")
Set WshShell=WScript.CreateObject("Shell.Application")
dirPath=WshShell.BrowseForFolder(0, "select the path", 0, "").items().item().path
if right(dirPath,1)<>"\" then
dirPath=dirpath&"\"
end if
if dirpath="\" then
dirpath="DOCUME~1\Admini~1\desktop\"
end if
msgbox dirpath