aaliyan
Messages postés104Date d'inscriptionsamedi 12 mars 2005StatutMembreDernière intervention30 avril 2007
-
17 avril 2007 à 16:39
cs_MPi
Messages postés3877Date d'inscriptionmardi 19 mars 2002StatutMembreDernière intervention17 août 2018
-
17 avril 2007 à 23:52
Voila, j'ai des fichiers word sur un serveur, et j'aimerais les ouvrir, mais le problème est que je n'y arrive, je ne sais pas comment mettre le chemin du fichier.
Le code :
Dim Chemin As String
Dim i As Long
Dim j As Long
On Error GoTo erreur
Set fs = Application.FileSearch
Set Wd = CreateObject("Word.Application")
j = 0
With fs
.Lookin = "Le serveur en question"
.SearchSubFolders = True
.FileName = "*.doc"
For i = 1 To .FoundFiles.Count
j = j + 1
Chemin = .FoundFiles(i)
With Wd
.Visible = True
.Documents.Open Chemin
.Activate
End With
Next i
End With
Exit Sub
erreur:
Call Wd.Quit
MsgBox "Problème sur le fichier : " & Chemin, vbInformation, "Problème"