ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Macro Help (https://www.excelbanter.com/excel-programming/279654-excel-macro-help.html)

raraujo

Excel Macro Help
 
Gentlemen,


Is there any VBA command that avoid the Message " Do you want
save...... YES NO CANCEL" when I am using the command"
ActiveWindow.Close. This message make my macro be interrupted.


Similar is the message that appear when do a copy and I close the file,
" There is a large amount of information on Clipboard......".
I want to avoid this kind of message.

Thanks

Rubens



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Dianne

Excel Macro Help
 
To avoid "Do you want to save"...

Application.DisplayAlerts = False
ActiveWindow.Close

To avoid the clipboard message...

Application.CutCopyMode = False

--
Dianne

In ,
raraujo typed:

Is there any VBA command that avoid the Message " Do you want
save...... YES NO CANCEL" when I am using the command"
ActiveWindow.Close. This message make my macro be interrupted.

Similar is the message that appear when do a copy and I close the
file, " There is a large amount of information on Clipboard......".
I want to avoid this kind of message.




Bob Phillips[_5_]

Excel Macro Help
 
Rubens,

If you want the workbook to be saved before closing, use

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Save
End Sub

If you don't want it saved, use

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Saved = True
End Sub

Put this in the ThisWorkbook code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"raraujo" wrote in message
...
Gentlemen,


Is there any VBA command that avoid the Message " Do you want
save...... YES NO CANCEL" when I am using the command"
ActiveWindow.Close. This message make my macro be interrupted.


Similar is the message that appear when do a copy and I close the file,
" There is a large amount of information on Clipboard......".
I want to avoid this kind of message.

Thanks

Rubens



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/




[email protected]

Excel Macro Help
 
Avoid message.

Application.DisplayAlerts = False
'Your code here.
Application.DisplayAlerts = True

----------------------------------------------------------------
Clipboard warning.

After the paste,

Application.CutCopyMode - False

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

Gentlemen,


Is there any VBA command that avoid the Message " Do you want
save...... YES NO CANCEL" when I am using the command"
ActiveWindow.Close. This message make my macro be interrupted.


Similar is the message that appear when do a copy and I close the file,
" There is a large amount of information on Clipboard......".
I want to avoid this kind of message.

Thanks

Rubens



Tom Ogilvy

Excel Macro Help
 
Application.Cutcopymode = False
ActiveWindow.Close SaveChanges:=True

or make it false if you don't want to save changes).

--
Regards,
Tom Ogilvy


"raraujo" wrote in message
...
Gentlemen,


Is there any VBA command that avoid the Message " Do you want
save...... YES NO CANCEL" when I am using the command"
ActiveWindow.Close. This message make my macro be interrupted.


Similar is the message that appear when do a copy and I close the file,
" There is a large amount of information on Clipboard......".
I want to avoid this kind of message.

Thanks

Rubens



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com