|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to exit from open work sheet without answering YES or NO
My workbook runs and creates 4 reports and saves theme in c:\datafile and stay open until I exit by answering the questions do I want to save Yes or No for each open reports.
How can I automatically exit without answering Yes or No questions? what VB code I need to do this task. Note * My answer is always is NO because the work book have created and save all reports in the path name that I have provided |
|
#2
|
||||
|
||||
|
activeworksheet.close?
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#3
|
|||
|
|||
|
The activeworksheet.close? did not work, may be I should explain more here is
my workbook get its input datafile and have 2 macro with first macro generate a workbook and stay open, the second macro run and copy the workbook sheet in 4 separate reports in c:\Path\data and stay open When I use your code after second macro it is still asking me do I want I want save the open data file?? what do I need to do. |
|
#4
|
|||
|
|||
|
Plz give your code or part of your code...I think some wrong where U closing the worksheet..
|
|
#5
|
||||
|
||||
|
sorry.. I didn't mean for you to actually use the "?" - I was just asking if it would work. I don't mess with Macro's very much.
|
|
#6
|
|||
|
|||
|
No Problem
I found out how to do this and here is Application.DisplayAlerts = False Application.Quit |
|
#7
|
|||
|
|||
|
I find DisplayAlertson msdn:
DisplayAlerts Property See Also Applies To Example Specifics True if Microsoft Excel displays certain alerts and messages while a macro is running. Read/write Boolean. Remarks The default value is True. Set this property to False if you dont want to be disturbed by prompts and alert messages while a macro is running; any time a message requires a response, Microsoft Excel chooses the default response. If you set this property to False, Micorosoft Excel sets this property to True when the code is finished, unless you are running cross process code. When using the SaveAs method for workbooks to overwrite an existing file, the 'Overwrite' alert has a default of 'No', while the 'Yes' response is selected by Excel when the DisplayAlerts property is set equal to True. Example This example closes the workbook Book1.xls and doesnt prompt the user to save changes. Any changes to Book1.xls arent saved. Application.DisplayAlerts = False Workbooks("BOOK1.XLS").Close Application.DisplayAlerts = True This example suppresses the message that otherwise appears when you initiate a DDE channel to an application thats not running. Application.DisplayAlerts = False channelNumber = Application.DDEInitiate( _ app:="WinWord", _ topic:="C:\WINWORD\FORMLETR.DOC") Application.DisplayAlerts = True Application.DDEExecute channelNumber, "[FILEPRINT]" Application.DDETerminate channelNumber Application.DisplayAlerts = True http://msdn.microsoft.com/library/d...splayAlerts.asp |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > How to exit from open work sheet without answering YES or NO |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|