Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Copy from Word into Excel pastes wrong picture

I've got a macro that parses through a Word document and copies and pastes
tables and figures into an Excel workbook. We've got a weird intermittent
bug where the wrong picture is pasted into Excel. (We're using Office 2000.)
It's pasting the same image twice in a row, even though different images are
being copied in Word. It's almost like the clipboard hasn't had a chance to
refresh between the copy and the paste command--as if the first image is
still on the clipboard and the new one hasn't made it to the clipboard yet.

The code is in a Word Template. Here's a code snippet:

Private mobjCurrentSheet As Excel.Worksheet
Private mobjExcelApp As Excel.Application

-- there's a bunch of code that scans down the document. when it finds a
picture, it does this: --
Selection.Paragraphs(1).Range.Copy

mobjExcelApp.ActiveCell.Offset(1, 0).Activate
mobjCurrentSheet.Paste




I tried putting this for loop in between the copy and the paste, but that
didn't help.
For i = 0 To 1000
DoEvents
Next i


As I mentioned, the bug is intermittent. Most of the time it works fine,
but it happens fairly requlary. I make sure I'm not doing anything else on
the PC while my code is running, so it can't be due to me trying to do a copy
and paste operation in my email app (for example) while the macro is running
in the background.

Does anyone have any ideas? Has anyone ever seen this type of behavior
before?

Thanks in advance for the help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Copy from Word into Excel pastes wrong picture

Hello Luggage,

I would like to suggest you clear the Windows Clipboard before you copy the
objects from word.

You could refer the following KB article in your code to clear the
clipboard:

How To Call Clipboard API from Visual Basic 4.0
http://support.microsoft.com/kb/159823

Hope this helps.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Copy from Word into Excel pastes wrong picture


Thanks.


"Wei Lu [MSFT]" wrote:

Hello Luggage,

I would like to suggest you clear the Windows Clipboard before you copy the
objects from word.

You could refer the following KB article in your code to clear the
clipboard:

How To Call Clipboard API from Visual Basic 4.0
http://support.microsoft.com/kb/159823

Hope this helps.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spreadsheet pastes as picture Worker Bee[_2_] Excel Discussion (Misc queries) 1 February 6th 09 01:28 AM
How copy editable text from Excell to Word and not get a picture? JamesDale Excel Discussion (Misc queries) 3 April 15th 08 10:50 PM
clipboard pastes wrong item Steve Keller Excel Discussion (Misc queries) 1 April 28th 07 11:05 PM
Excel macro that opens new MS Word file and pastes data as a pictu Rob Excel Worksheet Functions 0 July 6th 05 05:12 PM
VBA to copy a worksheet to word as a picture Marc[_11_] Excel Programming 1 September 3rd 03 12:52 PM


All times are GMT +1. The time now is 04:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"