View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jan Karel Pieterse Jan Karel Pieterse is offline
external usenet poster
 
Posts: 535
Default unable to close macro using auto_close or application.quit

Hi Gloria,

I
have used application.quit or auto_close, however, they
rerun the process again and again. I am not able to use
any of the close statment to shut of the application one
the macro ends. Basically, i do not want the user to see
the excel application. thanks in advance


When your macro has finished its work, add
Application.Quit as the last statement in the routine that is last
executed before the macro reaches its end.

You must make sure that all open workbooks are saved or closed (except
the one with the macro) without saving before this will work though.

To tell excel a workbook does not have to be saved when closing, use:

Workbooks("Yourbooksname.xls").Close SaveChanges:=False

Or alternatively set:

Workbooks("Yourbooksname.xls").Saved=True

This will tell Excel to forget whether any change has been made to a
workbook and it will close it without prompting for a save when you
quit Excel.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com