Share via

Is there a difference between ActiveDocument.Content and ActiveDocument.Range in VBA?

Anonymous
2012-06-26T17:18:27+00:00

Hello -- In a Word VBA macro, is there a difference between these 2 ranges:

FIRST ONE:

Dim Rng1 As Range

Set Rng1 = ActiveDocument.Range

SECOND ONE:

Dim Rng2 As Range

Set Rng2 = ActiveDocument.Content

Thank you,

-Lynne

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Jay Freedman 207.7K Reputation points Volunteer Moderator
2012-06-26T17:58:09+00:00

No, there is no difference when used that way.

The only difference is that .Content is a property only of the Document object, and it always refers to the document's main story; but the .Range property can be a property of many kinds of objects (Document, Section, Paragraph, Selection, etc.) and refers to the range of the parent object.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-06-26T17:54:24+00:00

No, there is no difference. They are equivalent to each other and to ActiveDocument.StoryRanges(wdMainTextStory)

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Stefan Blom 342.4K Reputation points MVP Volunteer Moderator
    2012-06-26T18:06:25+00:00

    For the Document object, Range is actually a method. Its Start and End parameters are optional, but they can be used to define a range object in the document.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2012-06-26T18:18:46+00:00

    Thank you all for this very useful information!

    Have a great day,

    -Lynne

    Was this answer helpful?

    0 comments No comments