Ouvrir un répertoire dans Explorer.exe

Ouvrir un répertoire dans Explorer.exe

Messagepar Michael DELIQUE » 21 Oct 2010 à 11:38

Code : Tout sélectionner
Sub WindowsOpenPath(wPath As String)
   
   'Déclaration variable
   Dim vrShell As Variant
   Dim Path As String
   
   On Error Goto ErreurHandle
   
   Path = "C:\"
   
   If Trim(wPath)<>"" Then
      If DirectoryIsValide(Trim(wPath)) = True Then
         Path = Trim(wPath)
      End If
   End If
   
   Set vrShell = CreateObject("WScript.Shell")
   vrShell.Exec("explorer "+Path)
   Set vrShell = Nothing
   
   Exit Sub
ErreurHandle:
   Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   Exit Sub
End Sub
Cordialement

Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN
Avatar de l’utilisateur
Michael DELIQUE
Administrateur
Administrateur
 
Message(s) : 12183
Inscrit(e) le : 16 Déc 2004 à 10:36
Localisation : Paris/Cergy

Messagepar mike76 » 22 Oct 2010 à 05:49

salut,

sinon tu as une ligne de moins avec :
Code : Tout sélectionner
Dim v As Variant
v = Shell("explorer.exe c:\toto", 1)


ou aussi en formule par exemple pour ouvrir un répertoire sur le réseau :
Code : Tout sélectionner
@URLOpen("file:\\\\SERV09\\Dossier Client\\TOTO" )
mike76
V.I.P.
V.I.P.
 
Message(s) : 2122
Inscrit(e) le : 12 Oct 2006 à 13:14
Localisation : ROUEN


Retour vers Gestion de fichiers