Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Clear Clipboard on Workbook Close Event (Excel XP)


Hi--

I'm working on a short macro that involves opening one Excel workbook,
copying the active sheet to a second workbook, then closing the first.

Problem: When I close this first workbook, I get a message box asking if
I want to keep what was copied to the clipboard available or not. I do
not, and I would like to cut this dialog exchange out of the program.
I've been unable to find the correct modifier to tell it to skip this.
Can someone help me? Here's the code section:

Dim Open1 As FileDialog
Set Open1 = Application.FileDialog(msoFileDialogOpen)
Open1.Show
Open1.Execute

Application.Workbooks(2).ActiveSheet.Cells.Copy
With Application.Workbooks(1).Sheets("Sheet2")
.Paste
End With

Appliation.Workbooks(2).Close

Is there a line I should add before this last telling it to clear the
clipboard? Or is there some property for .Close that will do it?

Second question: Could I accomplish the same thing using
msoFileDialogFilePicker instead of Open? I'm new at this and can't seem
to decipher whether "picking" a file lets you select a worksheet inside
it for copying or not.

Any help would be welcome.

Thanks,

Kelley

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Clear Clipboard on Workbook Close Event (Excel XP)

Application.Cutcopymode = False

would be the first thing to try.

If that doesn't work, then

Application.DisplayAlerts = False

--
Regards,
Tom Ogilvy

"Culichi" wrote in message
...

Hi--

I'm working on a short macro that involves opening one Excel workbook,
copying the active sheet to a second workbook, then closing the first.

Problem: When I close this first workbook, I get a message box asking if
I want to keep what was copied to the clipboard available or not. I do
not, and I would like to cut this dialog exchange out of the program.
I've been unable to find the correct modifier to tell it to skip this.
Can someone help me? Here's the code section:

Dim Open1 As FileDialog
Set Open1 = Application.FileDialog(msoFileDialogOpen)
Open1.Show
Open1.Execute

Application.Workbooks(2).ActiveSheet.Cells.Copy
With Application.Workbooks(1).Sheets("Sheet2")
.Paste
End With

Appliation.Workbooks(2).Close

Is there a line I should add before this last telling it to clear the
clipboard? Or is there some property for .Close that will do it?

Second question: Could I accomplish the same thing using
msoFileDialogFilePicker instead of Open? I'm new at this and can't seem
to decipher whether "picking" a file lets you select a worksheet inside
it for copying or not.

Any help would be welcome.

Thanks,

Kelley



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Clear Clipboard on Workbook Close Event (Excel XP)

Thanks, Tom. I tried the second one and it works great.

Kelley

Tom Ogilvy wrote:

Application.Cutcopymode = False

would be the first thing to try.

If that doesn't work, then

Application.DisplayAlerts = False



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
Still need help - Clear a cell upon workbook Close Gary Excel Discussion (Misc queries) 2 November 24th 09 08:40 PM
Workbook-Close StopTimer event Stonewall Rubberbow Excel Discussion (Misc queries) 2 January 12th 08 11:06 PM
Resetting Excel commandbars on close event alanperu Excel Programming 4 January 6th 04 02:34 PM
Trapping Excel Close Event Bob J.[_2_] Excel Programming 3 December 6th 03 08:57 PM
Trapping Excel Close event Bob J[_2_] Excel Programming 3 December 5th 03 11:56 PM


All times are GMT +1. The time now is 12:29 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"