darkspoilt
Expert
Bonjour,
J'ia un probleme d'exécution ma méthode Cells échoue une fois sur deux précisément donc je voudrais savoir si c'est du a une mérmoire a vider ou autre??
voila mon code
[cpp]Public Function Ligne(File As String) As Long
Dim AppExcel As Excel.Application
Dim wbFile As Excel.Workbook
Dim i As Long
'Initialisation
Ligne = -1
i = 1
'Ouverture d'excel
Set AppExcel = CreateObject("Excel.Application")
If Not AppExcel Is Nothing Then
'Ouverture du classeur
Set wbFile = AppExcel.Workbooks.Open(File, False, True)
If Not wbFile Is Nothing Then
i = 1
Do While Cells(i, 1).Value <> "TOTAL" Or Cells(i, 1).Value <> "Total"
i = i + 1
Loop
Ligne = i
wbFile.Close
Set wbFile = Nothing
End If
AppExcel.Application.Quit
Set AppExcel = Nothing
End If
End Function
[/cpp]
J'ia un probleme d'exécution ma méthode Cells échoue une fois sur deux précisément donc je voudrais savoir si c'est du a une mérmoire a vider ou autre??
voila mon code
[cpp]Public Function Ligne(File As String) As Long
Dim AppExcel As Excel.Application
Dim wbFile As Excel.Workbook
Dim i As Long
'Initialisation
Ligne = -1
i = 1
'Ouverture d'excel
Set AppExcel = CreateObject("Excel.Application")
If Not AppExcel Is Nothing Then
'Ouverture du classeur
Set wbFile = AppExcel.Workbooks.Open(File, False, True)
If Not wbFile Is Nothing Then
i = 1
Do While Cells(i, 1).Value <> "TOTAL" Or Cells(i, 1).Value <> "Total"
i = i + 1
Loop
Ligne = i
wbFile.Close
Set wbFile = Nothing
End If
AppExcel.Application.Quit
Set AppExcel = Nothing
End If
End Function
[/cpp]