Ouverture de fichier par userform

pierrefou Messages postés 3 Date d'inscription mardi 20 janvier 2004 Statut Membre Dernière intervention 4 février 2004 - 21 janv. 2004 à 12:06
pierrefou Messages postés 3 Date d'inscription mardi 20 janvier 2004 Statut Membre Dernière intervention 4 février 2004 - 21 janv. 2004 à 14:35
bonjour,

je souhaiterais ouvrir un fichier a l'aide d'un userform ou je pourrais spécifier :

- le disque dans une combo
- le dossier dans une liste
- puis le fichier ...

qq un pourrait il m'aider ou me donner un lien ou je peux trouver ca.

merci

pierre

2 réponses

econs Messages postés 4030 Date d'inscription mardi 13 mai 2003 Statut Membre Dernière intervention 23 décembre 2008 24
21 janv. 2004 à 14:18
Sur ton formulaire, tu places un drive (Drive1), un dirbox (dir1) et un filebox (File1), ainsi qu'un bouton (Command1)
*****************************************
code de la form
*****************************************

Public PREVIOUS_DRIVE As Long

Private Sub Command1_Click()
FaireQuelqueChose
End Sub

Private Sub Dir1_Change()
frmMain.lblPath = frmMain.Dir1.Path
End Sub

Private Sub Drive1_Change()

On Error GoTo errHandler

frmMain.Dir1.Path = frmMain.Drive1.List(Drive1.ListIndex)
PREVIOUS_DRIVE = frmMain.Drive1.ListIndex
frmMain.lblPath = frmMain.Dir1.Path
Exit Sub
errHandler:
MsgBox "Périphérique non connecté ou vide", vbCritical
frmMain.Drive1.ListIndex = PREVIOUS_DRIVE
End Sub

Private Sub Form_Load()
PREVIOUS_DRIVE = frmMain.Drive1.ListIndex
frmMain.lblPath = frmMain.Dir1.Path
frmMain.File1.Path = frmMain.Dir1.Path
End Sub

Private Sub FaireQuelqueChose()
If frmMain.File1.ListIndex <> -1 Then
'ouvrir le fichier
Else
MsgBox "Veuillez sélectionner un fichier", vbCritical
End If
End Sub

Manu
0
pierrefou Messages postés 3 Date d'inscription mardi 20 janvier 2004 Statut Membre Dernière intervention 4 février 2004
21 janv. 2004 à 14:35
la classe !

en plus je l'avais deja fait.... mais impossible de m'en souvenir.

Merci bcp

a+
0
Rejoignez-nous