Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically perform action when closing Excel Worksheet PaddyMac[_2_] Excel Programming 4 October 12th 09 04:10 AM
perform 1 function, stop, perform different function nastech Excel Discussion (Misc queries) 0 August 22nd 06 12:21 PM
close workbook without closing excel and stop recursive function chris Excel Discussion (Misc queries) 3 July 10th 06 08:23 PM
How to perform the following function in Excel? Eric Excel Worksheet Functions 3 March 5th 06 02:21 PM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM


All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"