Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto_Open Check date and Close
Sub Macro1()
' ' Macro1 Macro ' Macro recorded 8/1/2003 by DLS-Get Name on Open 'Sub Macro1() Sub Auto_Open() If Now Worksheets("data").Range("f10") Then Application.Displayalerts = False ThisWorkbook.Save '(I just added this to save without asking) Application.Quit (This is what's not working) End If Call Macro2 End Sub Quiting Excel will close the workbook - so you don't need to do it explicitly. as soon as you close the workbook, you macro stops executing - that is why the application.quit was not working. Of course, closing excel could screw up other workbooks the user has open. -- Regards, Tom Ogilvy <DLS wrote in message ... DLS Thanks John, Here is the code I have on autoopen. The application.Quit does not work. Maybe I didn't add it correctly. I like your extra code regarding hiding sheets. I'm going to study it and maybe that will be a better way to go or an addition to the following code. By the way, the audience is real estate agents and 99% of them would have no clue how to defeat the protection, but one percent might. Sub Macro1() ' ' Macro1 Macro ' Macro recorded 8/1/2003 by DLS-Get Name on Open 'Sub Macro1() Sub Auto_Open() If Now Worksheets("data").Range("f10") Then ThisWorkbook.Close Application.Save (I just added this to save without asking) Application.Quit (This is what's not working) End If Call Macro2 End Sub Sub Macro2() ' ' Macro2 Macro ' Macro recorded 7/30/2003 by DLS 'Sub GetInput() Dim MyInput 'This line of code is optional MyInput = InputBox("Enter Company Name") Range("data!f2").Value = MyInput MyInput = InputBox("Enter your Name") Range("data!f1").Value = MyInput MsgBox ("Hello ") & MyInput End Sub Thanks for your help DLS *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date to close file | Excel Worksheet Functions | |||
Excel shoud not close all active books when clicking close button | Excel Discussion (Misc queries) | |||
Why does spelling check close Excel when checking spanish? | Excel Discussion (Misc queries) | |||
Auto_Open Check date and Close | Excel Programming | |||
Auto_Open Check date and Close | Excel Programming |