Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



File Open Dialog box in Vista

Windows Server Help


Reply
 
Thread Tools Search this Thread
  #1  
Old 23-09-2006
Pete Gomersall
 
Posts: n/a
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


Reply With Quote
  #2  
Old 23-09-2006
Michael Harris \(MVP\)
 
Posts: n/a
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


Reply With Quote
  #3  
Old 25-09-2006
Pete Gomersall
 
Posts: n/a
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
>
>


Reply With Quote
  #4  
Old 29-01-2007
Member
 
Join Date: Jan 2007
Posts: 1
SAFRCFileDlg has been deprecated by Microsoft. The DLL was not actually intended to be used for scripting.

It iwll however still work for you on Vista. You just need to copy the DLL from an XP machine and register it with REGSVR32. Vista security will make you copy it to a folder other than System32 and register it that way.
Reply With Quote
  #5  
Old 20-08-2008
Member
 
Join Date: Aug 2008
Posts: 1
File Dialog in Vista

The best way I found to do it was to use word to get the file open dialog. Here is a sample function:

Function GetFileName()
Set oWord = CreateObject("Word.Application")

oWord.ChangeFileOpenDirectory(CreateObject("Wscript.Shell").SpecialFolders("Desktop"))

oWord.FileDialog(msoFileDialogOpen).Title = "Please Select the Additions File"
oWord.FileDialog(msoFileDialogOpen).AllowMultiSelect = False

If oWord.FileDialog(1).Show = -1 Then
oWord.WindowState = 2
For Each objFile in oWord.FileDialog(1).SelectedItems
GetFileName = objFile
Next
End If

oWord.Quit
End Function
Reply With Quote
  #6  
Old 08-05-2009
Member
 
Join Date: May 2009
Posts: 1
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
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "File Open Dialog box in Vista"
Thread Thread Starter Forum Replies Last Post
How to disable Open File - Security Warning dialog box in Windows Vista? Hayworth Vista Help 14 21-12-2011 03:31 PM
VLC freezes while using Open file Dialog Ikhyd Windows Software 5 20-04-2011 10:40 AM
Very slow File Open/Save Dialog PatrModer MS Office Support 6 08-11-2010 05:27 PM
File Open/Save Dialog not responding AliilA Vista Help 7 27-04-2010 06:06 PM
Solution to Open File Dialog Hang Domini Software Development 0 17-07-2008 02:42 PM


All times are GMT +5.5. The time now is 10:06 AM.