Bonjour à toutes et à tous,

je ne comprends pas, j'avais déjà testé ce module auparavant et il fonctionnait. Maintenant que je lance mon programme, il plante sur la macro suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Public Sub Search()
Dim i As Integer
Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Set wordApp = CreateObject("Word.Application")
wordApp.Visible = False
Dim ma_ligne As String, ADL As String, NomFicExt As String
Dim x As Integer, y As Integer, z As Integer, n As Integer
Dim ok As Boolean
ok = False
n = 1
i = 2
 
Do While Cells(i, 1) <> ""
 
If Cells(i, 9) <> "" Then
Else
Set wordDoc = wordApp.Documents.Open(Cells(i, 8)) '<--- Il plante ici, il me dit erreur de type
Do While ok
ma_ligne = Application.WorksheetFunction.Substitute(wordDoc.Sentences(n).Text, Chr(13), "")
If InStr(1, ma_ligne, W) = 1 Then
x = InStr(1, ma_ligne, "COR=")
y = InStr(1, ma_ligne, "ALR=")
ADL = Mid(ma_ligne, x + 4, 4) & Mid(ma_ligne, y + 4, 4)
z = InStr(1, ma_ligne, "NOM=")
ma_ligne = Right(ma_ligne, Len(ma_ligne) - (z + 4))
NomFicExt = Left(ma_ligne, Len(ma_ligne) - 1)
Cells(i, 9) = NomFicExt
Cells(i, 11) = ADL
ok = True
End If
n = n + 1
Loop
wordDoc.Close False
End If
 
i = i + 1
Loop
Set worDoc = Nothing
 
wordApp.Quit
Set wordApp = Nothing
 
ActiveWorkbook.Save
Call RemplissageHistoriqueRequete
 
End Sub
C'est dommage, je voulais tester mon appli qui est un veilleur ce week end.

Je vous remercie d'avance pour le temps que vous allez me consacrer.