Solved

Cut and Paste in MAPPOINT

Posted on 2003-11-05
5
435 Views
Last Modified: 2006-11-17
I am controlling Microsoft Mappoint and Powerpoint from VBA in Excel.  The program opens mappoint, does a dataset copy and then pastes it into powerpoint (to get the legend).

This works most of the time.  However, about 5% of the time, randomly, the copy operation fails and the subsequent paste operation actually pastes the previous contents of the clipboard.  It never fails in the same place and most of the time it doesn't fail at all.

This leads me to speculate that the copy operation, in mappoint,  is being performed asynchronously and thus my program gets control and initiates the paste before it completes.

Does anybody have a solution for this?  Is there anyway I can test the clipboard to see whether or not an operation is completed?   I've tried adding delays in the program and loops with doevents, but that seems to make the problem worse.

Help!


0
Comment
Question by:mfeldman
  • 3
5 Comments
 
LVL 1

Accepted Solution

by:
srikanth_a earned 500 total points
ID: 9691330

It might be due to size of the data which is copied on to the clipboard.

check the clipboard size and the size of data which does not get copied.



-srikanth
0
 

Author Comment

by:mfeldman
ID: 9691582
How do I check the clipboard size?  And is there a way for me to empty the clipboard (in VBA) prior to the cut/paste operation so I can make sure I have enough space?

Thanks for the help,

Mike
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 9695463
0
 

Author Comment

by:mfeldman
ID: 9696993
Thanks, but it doesn't seem to work.
In Excel, here's the code I tried for the test:

Declare Function EmptyClipboard Lib "user32" () As Long
Sub x()
    Range("A1").Copy
    z = EmptyClipboard()
    Range("B1").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
End Sub

The paste worked despite the emptyclipboard.  There was no error message, so I'm not quite sure what happened.

-Mike
0
 

Author Comment

by:mfeldman
ID: 9698590
It turns out that I really didn't have to completely empty the clipboard.  I simply put a
range("a1").copy
in the code which copied a null cell to the clipboard.  

This seems to have cured the problem, although since it was a somewhat random problem I want to test it a bit more.  But unless something turns up, I'll accept Srikanth's answwer.

-Mike
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

Suggested Solutions

My experience with Windows 10 over a one year period and suggestions for smooth operation
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

735 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