![]() |
Function to perform on closing an Excel Workbook
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 |
Function to perform on closing an Excel Workbook
Try this:
Sub Tester() Application.DisplayAlerts = False ActiveWorkbook.Close False Application.DisplayAlerts = True End Sub Tim "PaddyMac" wrote in message ... 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 |
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 |
Function to perform on closing an Excel Workbook
Tim
I am so sorry for not responding sooner - your message has only just shown up. I'll try it out tomorrow morning Many thanks. Kind regards Ian "Tim Williams" wrote: Try this: Sub Tester() Application.DisplayAlerts = False ActiveWorkbook.Close False Application.DisplayAlerts = True End Sub Tim "PaddyMac" wrote in message ... 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 . |
Function to perform on closing an Excel Workbook
jaarek
Sorry for not responding sooner - your post has only just shown up. I'll try it tomorrow morning. many thanks! Kind regards PaddyMac "Jarek Kujawa" wrote: 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 . |
All times are GMT +1. The time now is 09:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com