Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.comp.os.windows-xp    |    Actually wasn't too bad for a M$-OS    |    17,273 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 17,107 of 17,273    |
|    Paul to R.Wieser    |
|    Re: Problem : BrowseForFolder returns "T    |
|    16 Dec 25 07:53:06    |
   
   XPost: alt.comp.lang.vbscript, alt.windows7.general   
   From: nospam@needed.invalid   
      
   On Tue, 12/16/2025 5:26 AM, R.Wieser wrote:   
   > Hello all,   
   >   
   > XPsp3   
   >   
   > I have the need to select a file, and found "BrowseFolFolder" should be able   
   > to do it.   
   >   
   > The problem is that no matter the path or the file selected, all I get is a   
   > "The system cannot find the file specified" error.   
   >   
   > The stripped-down example :   
   >   
   > - - - - - - - - - - - - - -   
   > Set shell = CreateObject("Shell.Application")   
   > call shell.BrowseForFolder(0, "Choose a file:", &H4000, "c:\")   
   > - - - - - - - - - - - - - -   
   >   
   > I do not see what might be going wrong here. Help ?   
   >   
   > Regards,   
   > Rudy Wieser   
   >   
   >   
      
   When presented with your code, CoPilot sez:   
      
   This code selects a folder.   
      
   Set shell = CreateObject("Shell.Application")   
   Set folder = shell.BrowseForFolder(0, "Choose a folder:", &H4000, "c:\")   
      
   This code selects a file. We'll see in a moment, what the Copilot is up to.   
      
   Set dialog = CreateObject("UserAccounts.CommonDialog")   
   dialog.Filter = "All Files|*.*"   
   dialog.FilterIndex = 1   
   dialog.InitialDir = "C:\"   
   dialog.ShowOpen   
      
   *******   
      
   This is supposed to be a more complete example, according to the CoPilot.   
      
   ' Create the CommonDialog object   
   Set dlg = CreateObject("UserAccounts.CommonDialog")   
      
   ' Set filter (optional)   
   dlg.Filter = "All Files|*.*|Text Files|*.txt|Images|*.jpg;*.png"   
      
   ' Set initial directory (optional)   
   dlg.InitialDir = "C:\"   
      
   ' Show the Open dialog   
   result = dlg.ShowOpen   
      
   ' If user selected a file   
   If result <> 0 Then   
    WScript.Echo "You chose: " & dlg.FileName   
   Else   
    WScript.Echo "No file selected."   
   End If   
      
      
    Paul   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca