Solved

Cut and Paste in MAPPOINT

Posted on 2003-11-05
5
428 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
Comment Utility

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
Comment Utility
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
Comment Utility
0
 

Author Comment

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Some time ago I was asked to create a VBA function that would calculate a check digit for an input number, using the following procedure: First, sum up all the individual digits in the number If that sum value has more than one digit, then sum up …
Outlook Free & Paid Tools
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
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 …

744 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

17 Experts available now in Live!

Get 1:1 Help Now