Solved

Cut and Paste in MAPPOINT

Posted on 2003-11-05
5
441 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
[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
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
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  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

627 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