You are visitor number since 2 October 2004.
Go to Howard Kaikow's home page
Date: 2 October 2004
From: Howard Kaikow <kaikow@standards.com>
Subject: OLE Automation Problem (Word to PowerPoint)
When I Copy a selection from a Word document, then Paste into PowerPoint, a spurious OLE_Linknn bookmark is inserted into the Word document.
This problem occurs with Word 2002, and does not occur with Word 97 or Word 2000, not yet tested with Word 2003.
The problem also occurs if I run the code from VB 6. In this case, I had to modify the code to start Word and, check that there was already a Word document open. I then imported the VB 6 code into VS .Net. Same problem. Due to a bug in VB .Net (see KB article Q315981), I had to slightly modify the VB .Net code.
The bookmark is NOT created if PowerPoint is already running when the Word macro is run.
If PowerPoint is NOT running when the Word macro is run, the bookmark is added to the Word document as a result of creating the new instance of PowerPoint, i.e., even before the Word macro Pastes into PowerPoint. Note that the bookmark is added ONLY if there is not already a bookmark marking the full text to be copied.
I can reproduce the problem as follows:
I created the macro in a brand new template and added a reference to PowerPoint to the project.
Make sure PowerPoint is not running.
Double-click on the OLEPPT.dot template, which opens a blank document attached to the OLEPPT template.
For this test, you need not insert any text in the Word document. If you do, just place the insertion point in the text before you run the Word macro
Open the VBIDE, e.g., by using Alt + F11. Display the Immediate window so you can see the Debug.Print output.
Run the macro.
If the problem is reproduced, an OLE_Linknn bookmark will have been added to the Word document.
The macro will have created a PowerPoint presentation file in your default Word directory. You can delete the file.
OK, now delete the OLE_Linknn bookmark, start PowerPoint, and rerun the macro.
Hopefully, you will now find that no OLE_Linknn bookmark has been added,
The version of the macro I posted on 28 April 2002 will have created a PowerPoint presentation file in your default Word directory. You can delete the file. The 29 April 2002 version does not create that file.
I was using:
Word version 10.3416.3501 SP 1
PowerPoint version 10.3506.3501 SP 1
Windows 2000 (build 2195) SP 2
Office XP Developer Edition SP 1
VB 6 Enterprise SP 5
Microsoft Development Environment 2002 version 7.0.9466
Microsoft .Net Framework 1.0 version 1.3705
Norton Antivirus 2002, I have the Office plug-in disabled
Acrobat 5.0.5
The bookmark appears to be getting assigned as if a hard link was being used, rather than a Paste. The bookmark serves no purpose.
That's a real crock as it causes Word to request that the user save the Word document even tho the user may have made no changes to the document. I could add code to eliminate that bookmark and set the document's Saved property to True if there is no other reason to remain at False, but that's an even bigger crock.