Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Cut and Paste in MAPPOINT

Posted on 2003-11-05
5
Medium Priority
?
442 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 1500 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

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…
Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
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…

704 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