Excel Macro Help

  • Thread starter Thread starter raraujo
  • Start date Start date
R

raraujo

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
 
To avoid "Do you want to save"...

Application.DisplayAlerts = False
ActiveWindow.Close

To avoid the clipboard message...

Application.CutCopyMode = False
 
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)
 
Avoid message.

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

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

After the paste,

Application.CutCopyMode - False

HTH
Paul
 
Application.Cutcopymode = False
ActiveWindow.Close SaveChanges:=True

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