Results 1 to 2 of 2

Thread: Word macro vba - test if CHANGE is selected

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    2

    Smile Word macro vba - test if CHANGE is selected

    Hi there,
    I have what I am sure is a very simple question to answer. I know very little about VBA so help is requested for this.

    I have a lot of reviewing to do in a number of documents. I have set up a macro that will accept the current change (the one that is presently highlighted) and then jump to highlighting the next one.
    The trouble is that if I don't have a change highlighted then I of course get an error.
    What I would like to do is test if there is a change highlighted.
    If FALSE then jump to next change. If TRUE then accept it and jump to the next one.
    The existing code which was generated by macro recorder looks like this:

    Sub AcceptChange()
    WordBasic.AcceptChangesSelected
    WordBasic.NextChangeOrComment
    End Sub

    What must I add to get it to do what I have described?

    I give thanks for your time and assistance.

    Jonathan

  2. #2

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    2

    Re: Word macro vba - test if CHANGE is selected

    Hi have found one way to achieve my end result. Although I would still like to know how to do it via an IF THEN test based on whether a CHANGE is selected.
    The way I have pulled it off for now is to do this:
    ---------------------------
    Sub AcceptChange()
    On Error Resume Next
    WordBasic.AcceptChangesSelected
    WordBasic.NextChangeOrComment
    Exit Sub
    End Sub
    ----------------

    It achieves the result I want because if the Accept change part fails (due to a change not being selected) then it will simply run the next line... which is to jump to the next change.

Posting Permissions

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



Click Here to Expand Forum to Full Width