How to control MS OLE source bookmark creation for copy / paste?

1

Somehow, my MS Word 2016 (Office 365) configuration (under Windows 10, current level) is set so that every time I copy selected material and paste it elsewhere, the source material becomes an OLE (source) object / bookmark. I can manually remove the bookmark, but doing so is becoming tedious in the extreme. I've searched for some way to control this behavior, but haven't been able to find it.

My question is; how do I turn off the creation of the OLE object (source) definition when selecting and copying material in an MS Word document?

dvhirst

Posted 2017-06-07T04:57:46.677

Reputation: 29

Answers

0

Here is a macro to automatically delete the bookmarks straight after they're created. It doesn't delete other bookmarks, only the ones that start with "OLE_LINK".

The best place to put this is in the Normal.dot file. To find this, enable the Developer tab in the ribbon, and then click on the Visual Basic button. In there you can find a file called "ThisDocument" inside the "Normal" heading. Inside that file just put the following code and then save it.

Sub EditCopy()
    Selection.Copy
    DoEvents
    Application.OnTime Now + TimeValue("00:00:01"), "DeleteOleBookmarks"
End Sub

Sub DeleteOleBookmarks()
    Dim bmIndex As Integer
    Dim bmType As String
    DoEvents
    For bmIndex = ActiveDocument.Bookmarks.Count To 1 Step -1
        bmType = UCase(Left(ActiveDocument.Bookmarks(bmIndex).Name, 8))
        If bmType = "OLE_LINK" Then
            ActiveDocument.Bookmarks(bmIndex).Delete
        End If
    Next bmIndex
End Sub

This code was copied from here:
http://intrepidis.blogspot.co.uk/2018/05/ms-office-word-copy-text-and-it-puts.html

intrepidis

Posted 2017-06-07T04:57:46.677

Reputation: 111