Bonjour,
je suis novice dans ce forum et ne retrouve pas trace du message envoyé le 9...
Mon probléme: j'ai inséré une fonction de recherche de fichier "objShell.BrowseForFolder" (copiée d'exemples de macro) dans une suite de macro. Pas de probléme en W2000Pro mais ça ne marche plus en XPPro (pas de valeur renvoyé par la fonction).
Qui peut m'aider à trouver où est l'erreur?
Merci d'avance.
Jean-Francois.
La fonction compléte:
Function ChoixDossierFichier(Racine, Appel, Optional SelType As Byte = 0)
Dim objShell, objFolder, Chemin, SecuriteSlash, FlagChoix&, Msg$
SelType = 1
If SelType = 0 Then
FlagChoix = &H1&: Msg = "Choisissez un dossier :"
Else
FlagChoix = &H4000&: Msg = "Choisissez un fichier " + Appel + " à ouvrir"
End If
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(&H0&, Msg, FlagChoix, Racine)
On Error Resume Next
Chemin = objFolder.ParentFolder.ParseName(objFolder.Title).Path & ""
If objFolder.Title = "*.xls" Then
Chemin = "D:\data\jfg\janie"
End If
If objFolder.Title = "" Then
Chemin = ""
End If
SecuriteSlash = InStr(objFolder.Title, ":")
If SecuriteSlash > 0 Then
Chemin = Mid(objFolder.Title, SecuriteSlash - 1, 2) & ""
End If
ChoixDossierFichier = Chemin
End Function