Have you recently found that copying something in Microsoft Word causes the copied text to have grey square brackets surround it?
These brackets are showing because the "show bookmarks" option is enabled. Indeed you may want to keep that option enabled, as you have other bookmarks that you want to see while editing.
The new bookmarks are being created with a certain naming format, they are sequentially numbered and are named like "OLE_LINK##". These bookmarks are automatically created by Word.
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
No comments:
Post a Comment