getting the heading of a selected text in word

Posted by Thunder on Stack Overflow See other posts from Stack Overflow or by Thunder
Published on 2010-05-12T11:19:05Z Indexed on 2010/05/12 11:24 UTC
Read the original article Hit count: 266

Filed under:
|
|
|
|

Hi, I am working With Microsoft Word VBA,macros. My question : Is there way to get sub-topic and master-topic that precedes a selected body text ?

Here is an example:

  • Master topic (level 1)
  • sub-topic 1 (level 2)
    • body text a
    • body text b body text c
  • sub-topic 2 (level 2)
    • body text d
    • body text e
  • Other MISC topics (level 2) body text f body text g body text h

Here if 'bodytext e' is selected I would like to run a macro and get the result as 'Master topic:sub-topic 1'

I have tried with range,parent ,Scope.Information(wdActiveEndSectionNumber) etc but nothing seem to work!!!

Thanks in Advance

© Stack Overflow or respective owner

Related posts about word

Related posts about msword