?
Solved

Excel macro-Clipboard answer

Posted on 2002-07-03
3
Medium Priority
?
1,271 Views
Last Modified: 2011-10-03
How do I write my Excel 2000 macro to automatically answer the following question "YES"?  "There is a large amount of information on the Clipboard.  Do you want to be able to paste this information into another program?" Yes/No/Cancel are choices.
This pops up whenever I try to close one spreadsheet (csv file) after I have copied its entire contents to the clipboard for pasting into another spreadsheet.
0
Comment
Question by:mcqj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 46

Expert Comment

by:aikimark
ID: 7127721
I'm not sure that can be done exactly as you wish.

You can use the DataObject in place of the Clipboard object if your Excel VBA code is doing the movement of data.  If you're doing the copy/paste by hand instead of programmatically, you're out of luck.

You might include code in the worksheet close event that will copy the contents of the clipboard to the dataobject and clear the clipboard.

Be warned: unlike the clipboard object, the Dataobject contents aren't persistent beyond the life of the Excel program.
0
 

Author Comment

by:mcqj
ID: 7127742
Could you please illustrate the movement of all cells of one spreadsheet into another spreadsheet using the DataObject in place of the Clipboard?

The best I've been able to do so far is to use:
Application.DisplayAlerts = False
0
 
LVL 46

Accepted Solution

by:
aikimark earned 300 total points
ID: 7127771
If you need all cells, then you really want to do a worksheet copy operation, don't you?  

The following two examples copy without using the clipboard, since I specify the destination with the copy operation.

Example of copying an entire worksheet:
Worksheets("Sheet1").Copy after := Worksheets("Sheet3")

Example of copying the used range to another worksheet:
Worksheets("Sheet1").UsedRange.Copy destination:=Worksheets("Sheet3").Range("A1")
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question