Solved

Excel macro-Clipboard answer

Posted on 2002-07-03
3
1,262 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
  • 2
3 Comments
 
LVL 45

Expert Comment

by:aikimark
Comment Utility
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
Comment Utility
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 45

Accepted Solution

by:
aikimark earned 100 total points
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now