Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Spreadsheet pastes as picture | Excel Discussion (Misc queries) | |||
How copy editable text from Excell to Word and not get a picture? | Excel Discussion (Misc queries) | |||
clipboard pastes wrong item | Excel Discussion (Misc queries) | |||
Excel macro that opens new MS Word file and pastes data as a pictu | Excel Worksheet Functions | |||
VBA to copy a worksheet to word as a picture | Excel Programming |