LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date to close file PSM[_20_] Excel Worksheet Functions 2 November 23rd 09 08:50 AM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
Why does spelling check close Excel when checking spanish? RCP Excel Discussion (Misc queries) 2 December 4th 04 07:37 PM
Auto_Open Check date and Close Dan Smith Excel Programming 0 August 2nd 03 10:39 PM
Auto_Open Check date and Close DLS[_2_] Excel Programming 1 August 1st 03 09:21 PM


All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"