0
votes

I'm trying to read comments for figures in a document using the code below

For Each iShp In .InlineShapes
  iShp.Select

  If Selection.Comments.Count > 0 Then
    MsgBox Selection.Comments(1).Range.text
  End If
Next

The shapes are selected properly, however the count is always 0...

What am I missing?

1
I don't believe InlineShapes has a comments property. What you have there is taking the comments from the selection, of which there are not any. There is .AlternativeText and .Title for shapes.Warcupine
You need to provide more information about these comments. It's not clear where they're located. Perhaps a screen shot could help...Cindy Meister

1 Answers

1
votes

Here's an alternative way to read all the comments:

Option Explicit

Sub DisplayCommentText()
    With ActiveDocument
        Dim cmt As Comment
        For Each cmt In .Comments
            Debug.Print cmt.Range.Text
        Next cmt
    End With
End Sub