problems with application close

  • Thread starter Thread starter Matthijs de Z
  • Start date Start date
M

Matthijs de Z

Hi,

I'm trying to make a macro in VBA for excel to close the sheet/application.

After looking up some codes on the internet, I still get the popup alert
with the question whether I want to save the changes or not.

I've tried all of these codes:

Function activeer()

Application.ScreenUpdating = False
Application.DisplayAlerts = False

'Call CopySpecificFile
'Call CopyFileType

'Application.ScreenUpdating = True
'Application.DisplayAlerts = True

'Application.Quit
'ThisWorkbook.Close savechanges:=False

'ActiveWorkbook.Close False
'Application.Quit

'Workbooks("kopieer test2.xls").Saved = True
' Application.Quit

'Application.Quit
'Workbooks("kopieer test2.xls").Sheets("blad1").Activate
'ActiveWorkbook.Close SaveChanges:=False

'ThisWorkbook.Saved = True
'ActiveWorkbook.Saved = True
'ThisWorkbook.Close
'Application.Quit

Application.Quit
ActiveWorkbook.Close SaveChanges:=True

End Function


None of them seem to work the way I want. All I want is to close excel
without saving anything. Anybody got an advice?
Best regards,

Matthijs
 
try
sub quitit()
Application.DisplayAlerts = False
Application.Quit
end sub

It still asks 'do you want to save the changes you made to "the name.xls"?'
;-(

In the sheet I use the now() function to activate a function. Could this
have anything to do with it? 1 cell does get another value after the
startup...on the other hand... i tried it with savechanges = false...and
that didn't work too.

Matthijs
 
try
sub quitit()
Application.DisplayAlerts = False
Application.Quit
end sub

I've found out that when I use the code in a sub and run it manually, it
does close the application, but I nee excel the run automatically, run some
subs and then close the sheet. How can I run a sub on load?
Best regards,

Matthijs
 
Back
Top