View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jarek Kujawa[_2_] Jarek Kujawa[_2_] is offline
external usenet poster
 
Posts: 896
Default Function to perform on closing an Excel Workbook

1. where would you like the clipboard to be saved?
....
2. to ignore saving changes do as follows:
press ALT+F11 to get to VBA window
then in Project-VBAProject double click on ThisWorkbook object
select Workbook in a window where (General) is displayed
select BeforeClose in the rightmost window

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
ActiveWorkbook.Close savechanges:=False
End Sub



On 15 Paź, 05:29, PaddyMac wrote:
I wish to automate the closing of an Excel workbook so that Excel does
not save any changes, but does save what has been copied to the
clipboard.

I have got as far as.

ActiveWorkbook.Close

and am stuck

Any ideas?

Many thanks.

Kind regards

PaddyMac