Copy_Err_Handler: Dim tempXL As Object Set tempXL = GetObject(tempFile) ', "Excel.Application") If tempXL.Application.Visible = False Then tempXL.Application.Quit End If Err.Clear GoTo copy
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionCopy_Err_Handler: Dim tempXL As Excel.Application Dim founded As Boolean Set tempXL = GetObject(tempFile) If tempXL.Workbooks(1).FullName = tempFile Then tempXL.Visible = True founded = True 'tempXL.Quit End If GoTo copy
Copy_Err_Handler: Dim tempXL As Excel.Application Dim founded As Boolean Set tempXL = GetObject(,"Excel.Application") '<--- pour excel tu ne peux pas faire autrement 'pour savoir si tempfile est ouvert cette appli XL tu peux faire comme ceci On local Error Resume Next tempXL.tempfile.Ativate 'ici on tente d'activer le fichier If err = 0 Then 'si pas d'erreur c'est que le fichier est bien la tempXL.Visible = True founded = True 'tempXL.Quit Else MsgBox "le fichier " & tempfile & " n'est pas ouvert ! ", vbexclamation End If