Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bookmarks don't move during cut and paste (Word 2000 - 2007)

    This is a known Microsoft bug in Word. If a word, sentence, paragraph, etc. has a bookmark assocated with it and if Track Changes if turned on, then the book mark does not move during a Cut and Paste operation. If Track Changes is turned off then the bookmark does move during a cut and paste. I looking for a way to catch an event such as for example "a cut event" where I can check to see if a bookmark exists in or next to a section of text that the bookmark is associated with and include the bookmark in the cut event. This event would only be handled if track changes is turned on.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bookmarks don't move during cut and paste (Word 2000 - 2007)

    You already asked this (or something very similar) in <post:=586,311>post 586,311</post:> (the last thread in which you reacted to a reply) and <post:=609,122>post 609,122</post:>.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks don't move during cut and paste (Word 2000 - 2007)

    I know Hans I have posted such a question and I have tried jscher2000's suggestion without success so I thought I would repost with shorter version of my question hoping it was clearer.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bookmarks don't move during cut and paste (Word 2000 - 2007)

    In the future, it would be better to post a new reply in the existing thread (preferably with an explanation of what you tried and in what way it didn't do what you want) than to start three different threads with the same question.

    I'm afraid I have no other suggestions than the ones from the previous threads.

  5. #5
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmarks don't move during cut and paste (Word 2000 - 2007)

    Hans

    Thank you and I apologize for not following the practice you suggested and will in the future.
    Below is a simple example I tried in the past placed into a template in the thisdocument object:

    Private Sub EditCut()

    Dim str As String

    str = Selection.Text

    MsgBox (str)


    End Sub

    Private Sub EditPaste()

    Dim str As String

    str = Selection.Text

    MsgBox (str)
    End Sub

    These are never called and I also placed debug commands to confirm that these events are never hit. Even if they were working I am not sure how one would test to see if a bookmark existed before the selection since "selection.Bookmarks.Exists" is a test for a bookmark if it existed in the selection. If I can discover how to look for a bookmark before or after a selection then I can use one of mthe insert methods contained in selection.

    Oh I am using Excel 2007 and wonder if there is some sort of macro security setting that is preventing the events from firing.

    Thank you

  6. #6
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Bookmarks don't move during cut and paste (Word 2000 - 2007)

    I wonder if your problem is something as simple as needing to define
    <code>Public Sub</code>
    rather than
    <code>Private Sub</code>

    StuartR

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bookmarks don't move during cut and paste (Word 2000 - 2007)

    The macros should not be in ThisDocument, but in a standard module, and they should be Public instead of Private.

    You could use code like this:

    Public Sub EditCut()
    Dim rng As Range
    Set rng = Selection.Range
    rng.MoveStart Count:=-1
    rng.MoveEnd
    If rng.Bookmarks.Count > 0 Then
    MsgBox "Bookmark alert!"
    End If
    End Sub

    Warning: keep in mind that EditCut and EditPaste replace the built-in commands, so you must execute the commands (Selection.Cut, Selection.Paste) within the macro, otherwise nothing will happen.

    PS I don't have Word (or Excel) 2007 yet, so I cannot help you with issues that are specific to this new version.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •