Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

paragraph references

Status
Not open for further replies.

overandout

Technical User
Jan 16, 2005
3
US
I am writing a technical document and would like to create references to paragraphs (which are auto numbered).
The goal is that even if a new paragraph is inserted or deleted, the reference should still be accurate.

Example in Paragraph 1 there is a reference to paragraph 8.
A new paragraph is inserted at 6.
The reference in paragraph 1 should automatically update to reference paragraph 9.

Thanks,
 
Hmmm...Not sure how to do this without VBA. There is a bookmark functionality in Word, but not sure how to tie it to line nubmers/paragraph numbers. There is, however, an index object in VBA which allows you to enumerate the paragraphs in a selection.

Here's the syntax:
Code:
Selection.Paragraphs (Index)

Not sure how you might tie it together, but my guess would be to set a bookmark in the paragraph you want to reference, and set a bookmark in the paragraph to which you want to return, then use VBA to find that bookmark, set a variable = to the value of the index number. Use VBA to return to the paragraph you started from and insert the index number. It probably wouldn't be automatic - you would have to update it from a click event or something.

Here's the syntax to find a bookmark in a document (change the item in red):
Code:
ActiveDocument.Bookmarks("[!]myBookmark[/!]").Select

Hope this is enough to get you started. My guess is that there is a method not requiring VBA, so you might want to hang on for that. If there is no response, let me know and I will help write the code.

Tom

Live once die twice; live twice die once.
 
The goal is that even if a new paragraph is inserted or deleted, the reference should still be accurate.
If what you mean is that this is done automatically...no.

Example in Paragraph 1 there is a reference to paragraph 8.
A new paragraph is inserted at 6.
The reference in paragraph 1 should automatically update to reference paragraph 9.

But before going further...what exactly do you mean by "reference".

in Paragraph 1 there is a reference to paragraph 8
What - precisely - are you using to make that reference?

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top