Question about closing excel.
What vb-code can I put in my macro formula to close the program excel? I use this code to close the document without saving:
Application.DisplayAlerts = False
ActiveWorkbook.Close
This code only closes te document and not the whole excel program. What code can I use for that?
Thanks for replies!
Greetz Relli.
Sorry, nog een keertje...... Foutje van mij.
Hoi! Probeer dit eens
Option Explicit
Public Sub fExcel()
'excel ****
Dim objExcel As Excel.Application
Dim objWorkbook As Excel.Workbook
Dim objWorksheet As Excel.Worksheet
Dim objChart As Excel.Chart
Dim objRng As Range
Set objRng = Nothing
Set objChart = Nothing
exit_Handler:
'Free up memory, otherwise there will be a memory leak.
Set objWorksheet = Nothing
objWorkbook.Close False
Set objWorkbook = Nothing
objExcel.Quit
Set objExcel = Nothing
Exit Sub
err_handler:
MsgBox Err.Description, vbInformation
Err.Number = 0
Resume exit_Handler
End Sub
Ben je erg nieuw met programmeren?
Ik had een funktie geschreven, maar daar het jij nu even niets aan. Je kan het ook als een sub gebruiken. ff koppie-peesten