|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| | |
| | |
| | |
| | |
| | |
|
|
fleXcel |
www.flexcel.se Medlem sedan: 2009-01-31
62 inlägg
|
|
|
Hej, jag använder Windows10 och nu upptäcker jag efter ngn uppdatering att Excel inte avslutas helt efter att jag gett kommandot Application.Quit ?? Excel stänger ner men det blir kvar en ruta som jag manuellt behöver avsluta, med typ Alt + F4
Är det någon här i forumet som har en lösning för detta ??
Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.ScreenUpdating = False If Y = False Then X = MsgBox("Avsluta / Spara", vbYesNo, "Spara ??") If X = 6 Then Y = True ActiveWorkbook.Close SaveChanges:=True End If End If ActiveWindow.Zoom = 100 ActiveWorkbook.Windows.Application.DisplayFullScreen = False ActiveWindow.DisplayHeadings = True Application.DisplayFormulaBar = True With ActiveWindow .DisplayHorizontalScrollBar = True .DisplayVerticalScrollBar = True End With With ActiveWorkbook .RunAutoMacros xlAutoClose .Close End With Application.Quit End Sub
|
|
|
|
| |
|
fleXcel |
www.flexcel.se Medlem sedan: 2009-01-31
62 inlägg
|
|
|
Hittade på nätet följande från Microsoft...
"How to suppress Save Changes" prompt when you close a workbook in Excel
Example 1: Close the workbook without saving changes To force a workbook to close without saving any changes, type the following code in a Visual Basic module of that workbook:
Sub Auto_Close()
ThisWorkbook.Saved = True
End Sub
The DisplayAlerts property of the program can be used for the same purpose. For example, the following macro turns DisplayAlerts off, closes the active workbook without saving changes, and then turns DisplayAlerts on again.
Sub CloseBook()
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub
You can also use the SaveChanges argument of the Close method.
The following macro closes the workbook without saving changes:
Sub CloseBook2()
ActiveWorkbook.Close savechanges:=False
End Sub
Example 2: Close the workbook and save the changes To force a workbook to save changes, type the following code in a Visual Basic module of that workbook:
Sub Auto_Close()
If ThisWorkbook.Saved = False Then
ThisWorkbook.Save End If
End Sub
This subprocedure checks to see if the file Saved property has been set to False. If so, the workbook has been changed since the last save, and those changes are saved.
|
|
|
|
| |
| | |
| | |
| | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|