[VBA Excel] boite de recherche fichier
jeff47
Messages postés
1
Statut
Membre
-
G.David Messages postés 790 Statut Membre -
G.David Messages postés 790 Statut Membre -
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
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
2 réponses
-
ne serait pas un problème de bibliothèque sur ta version XP ? VBA outils Références
-
bonsoir , je voudrais savoir comment faire pour inserer dans un message sur un forum un tableau excel merci d'avance, a tous
willy-
-
-
Salut
dans les forum CCM il n'y a pas de gestion de pièces jointes il faut passer par un truc du style ci-joint qui est temporaire pour excel je te conseilles
https://www.excel-downloads.com/
ou http://www.veriti.net
tout deux sedié à Excel et acceptant les pieces jointes . Ces forum sont type entraide comme CCM
G.David
-