Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    676
    Thanks
    28
    Thanked 2 Times in 2 Posts
    I use the following macro to insert comments in Word 2007 using the traditional comment pane.

    With ActiveDocument.ActiveWindow
    .Selection.Comments.Add Range:=Selection.Range
    If .View.SplitSpecial <> wdPaneComments Then
    .View.SplitSpecial = wdPaneComments
    End If
    End With

    This works fine, but it inserts a page field {PAGE \# "Page: '#'"} before the comment, although this is only visible when field codes are displayed (e.g., Alt + F9); otherwise, nothing is visible. This does not happen if I use another method to insert comments - e.g., the "New Comment" button on the ribbon - but I wish to use the above macro because I prefer the traditional comment pane. What is causing the page fields to be inserted, and how can I prevent this?

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    That is a really weird effect; never saw it before and unfortunately have no idea why it's happening. Just want to note fwiw that it's not specific to Word 2007 - just tested it on a PC that has Word 2002 and got the same effect.

    Gary

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    676
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Thanks for your reply. As a work-around, I have made field codes always visible (Options > Advanced > Show document content > Show field codes instead of their values), and tweaked the macro to delete the field that it has inserted.

    With ActiveDocument.ActiveWindow
    .Selection.Comments.Add Range:=Selection.Range
    If .View.SplitSpecial <> wdPaneComments Then
    .View.SplitSpecial = wdPaneComments
    End If
    End With
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=1

Posting Permissions

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