Results 1 to 6 of 6

Thread: File Open Dialog box in Vista

  1. #1
    Pete Gomersall Guest

    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


  2. #2
    Michael Harris \(MVP\) Guest

    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



  3. #3
    Pete Gomersall Guest

    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
    >
    >



  4. #4
    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.

  5. #5
    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

  6. #6
    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

Similar Threads

  1. Replies: 14
    Last Post: 21-12-2011, 03:31 PM
  2. VLC freezes while using Open file Dialog
    By Ikhyd in forum Windows Software
    Replies: 5
    Last Post: 20-04-2011, 10:40 AM
  3. Very slow File Open/Save Dialog
    By PatrModer in forum MS Office Support
    Replies: 6
    Last Post: 08-11-2010, 05:27 PM
  4. File Open/Save Dialog not responding
    By AliilA in forum Vista Help
    Replies: 7
    Last Post: 27-04-2010, 06:06 PM
  5. Solution to Open File Dialog Hang
    By Domini in forum Software Development
    Replies: 0
    Last Post: 17-07-2008, 02:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •