Bonjour
J'ai l'erreur suivante : Erreur de compilation : Type défini par l'utilisateur non défini
Cela se produit sur un appel d'une méthode qui enregistre les erreurs dans un fichier texte :
Appel de la fonction :
Fonction :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 If Err.Number <> 0 Then ErrorLog Err.Number, Err.description, Err.source End If
Je ne programme pas beaucoup sous VBA.
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 Private Sub ErrorLog(num As Variant, description As Variant, source As Variant) Dim oFSO Set oFSO = Nothing Set oFSO = CreateObject("Scripting.FileSystemObject") Dim oTxt As Scripting.TextStream Dim Text As String 'Instanciation du FSO Set oFSO = New Scripting.FileSystemObject Set oTxt = oFSO.OpenTextFile("C:\monfichier.txt", ForReading) Set oTxt = oFl.OpenAsTextStream(ForWriting) Text = CStr(Now()) + " " + CStr(num) + "|" + CStr(description) + "|" + CStr(source) oTxt.WriteLine Text oTxt.Close oFSO = Nothing End Sub
Quelqu'un peut il m'aider à résoudre ce problème?
Est ce que mon code est correct?
Partager