1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| Sub t()
Dim oExcel As Excel.Application
Dim oWkb As Workbook
Dim PathName As String
PathName = "C:\Users\phili\Dropbox\MagicOffice - Test\Data\1903 - TimeSheet Rachel.xlsx"
Set oExcel = New Excel.Application ' GetObject(, "Excel.Application")
oExcel.Visible = True ' Rend visible l'application
Set oWkb = oExcel.Workbooks.Open(PathName)
If MsgBox("Voulez-vous quitter Excel", vbYesNo + vbDefaultButton2) = vbYes Then
On Error Resume Next ' Au cas où l'utilisateur a fermer le classeur
oWkb.Close SaveChanges:=True
On Error GoTo 0
oExcel.Quit
End If
Set oExcel = Nothing: Set oWkb = Nothing
End Sub |