![]() |
Macro to quit application
I was told to create command button and call macro quitapplication, record,
ok and the stop recording, Empty Macro? The it says edit macro by inserting a line ActiveWorkbookClose after the comments? I assume this is in VB but I really dont know where in Vb to enter the above. Tried everything but no success Help Steve |
Macro to quit application
Insert ActiveWorkbookClose directly under the last apostrophe, before the
first action recorded - this is what is meant by "after the comments." HTH Doug Davey "K11ngy" wrote: I was told to create command button and call macro quitapplication, record, ok and the stop recording, Empty Macro? The it says edit macro by inserting a line ActiveWorkbookClose after the comments? I assume this is in VB but I really dont know where in Vb to enter the above. Tried everything but no success Help Steve |
Macro to quit application
Thanks Doug
I tried as below, probably me being stupid but didnt work, is it in wrong place? Sub quit() ' ' quit Macro ' Macro recorded 06/07/2007 by stephenking ' ' activeworkbookclose End Sub "Doug Davey" wrote: Insert ActiveWorkbookClose directly under the last apostrophe, before the first action recorded - this is what is meant by "after the comments." HTH Doug Davey "K11ngy" wrote: I was told to create command button and call macro quitapplication, record, ok and the stop recording, Empty Macro? The it says edit macro by inserting a line ActiveWorkbookClose after the comments? I assume this is in VB but I really dont know where in Vb to enter the above. Tried everything but no success Help Steve |
Macro to quit application
try
application.quit -- Don Guillett Microsoft MVP Excel SalesAid Software "K11ngy" wrote in message ... I was told to create command button and call macro quitapplication, record, ok and the stop recording, Empty Macro? The it says edit macro by inserting a line ActiveWorkbookClose after the comments? I assume this is in VB but I really dont know where in Vb to enter the above. Tried everything but no success Help Steve |
Macro to quit application
Perfect placement in the macro - however the syntax is
ActiveWorkbook.Close notice the period. Also Case sensitive HTH "K11ngy" wrote: Thanks Doug I tried as below, probably me being stupid but didnt work, is it in wrong place? Sub quit() ' ' quit Macro ' Macro recorded 06/07/2007 by stephenking ' ' activeworkbookclose End Sub "Doug Davey" wrote: Insert ActiveWorkbookClose directly under the last apostrophe, before the first action recorded - this is what is meant by "after the comments." HTH Doug Davey "K11ngy" wrote: I was told to create command button and call macro quitapplication, record, ok and the stop recording, Empty Macro? The it says edit macro by inserting a line ActiveWorkbookClose after the comments? I assume this is in VB but I really dont know where in Vb to enter the above. Tried everything but no success Help Steve |
Macro to quit application
This doesn't sound like a very nice workbook to me.
I can have multiple workbooks open that you (as a developer) don't know about. If your workbook tries to close all my workbooks, I could lose data or I could save data that I didn't want saved. How will your code handle the other workbooks that are open--will it save them without asking, then close them? Will it close them without saving? In either case, I would expect users to come running at you with pitchforks for the data that got screwed up. On the other hand if you wanted to close the workbook that has that button, you could use a line like: thisworkbook.close savechanges:=true 'or false???? But you still may have the users asking why they lost 2 hours of work or how to get the original data back that was overwritten. And the command you may want to use is: Application.Quit (don't do it without lots of thought for your co-workers) K11ngy wrote: I was told to create command button and call macro quitapplication, record, ok and the stop recording, Empty Macro? The it says edit macro by inserting a line ActiveWorkbookClose after the comments? I assume this is in VB but I really dont know where in Vb to enter the above. Tried everything but no success Help Steve -- Dave Peterson |
Macro to quit application
ps.
Activeworkbook.close will try to close the workbook that's active--not the workbook with the code. Thisworkbook.close will try to close the workbook that owns the code. K11ngy wrote: I was told to create command button and call macro quitapplication, record, ok and the stop recording, Empty Macro? The it says edit macro by inserting a line ActiveWorkbookClose after the comments? I assume this is in VB but I really dont know where in Vb to enter the above. Tried everything but no success Help Steve -- Dave Peterson |
Macro to quit application
Thanks Steve, that worked perfect
One more thing if you can help please I want Excel to open at a certain worksheet (Main menu-Splash screen) Could you help me with where to place code and what code is Thanks Steve King "steve_doc" wrote: Perfect placement in the macro - however the syntax is ActiveWorkbook.Close notice the period. Also Case sensitive HTH "K11ngy" wrote: Thanks Doug I tried as below, probably me being stupid but didnt work, is it in wrong place? Sub quit() ' ' quit Macro ' Macro recorded 06/07/2007 by stephenking ' ' activeworkbookclose End Sub "Doug Davey" wrote: Insert ActiveWorkbookClose directly under the last apostrophe, before the first action recorded - this is what is meant by "after the comments." HTH Doug Davey "K11ngy" wrote: I was told to create command button and call macro quitapplication, record, ok and the stop recording, Empty Macro? The it says edit macro by inserting a line ActiveWorkbookClose after the comments? I assume this is in VB but I really dont know where in Vb to enter the above. Tried everything but no success Help Steve |
All times are GMT +1. The time now is 09:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com