[VBA Excel] boite de recherche fichier
jeff47
Messages postés
1
Date d'inscription
Statut
Membre
Dernière intervention
-
G.David Messages postés 769 Date d'inscription Statut Membre Dernière intervention -
G.David Messages postés 769 Date d'inscription Statut Membre Dernière intervention -
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
A voir également:
- [VBA Excel] boite de recherche fichier
- Fichier bin - Guide
- Fichier epub - Guide
- Fichier rar - Guide
- Comment réduire la taille d'un fichier - Guide
- Fichier .dat - Guide
2 réponses
bonsoir , je voudrais savoir comment faire pour inserer dans un message sur un forum un tableau excel merci d'avance, a tous
willy
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
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