Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 889481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:34:29+00:00 2026-05-15T13:34:29+00:00

I am working With Microsoft Word VBA,macros,.net My question : Is there way to

  • 0

I am working With Microsoft Word VBA,macros,.net
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 that gives a result text
Master topic:sub-topic 1.
I have tried with range,parent ,Scope.Information(wdActiveEndSectionNumber) etc but nothing seem to work!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:34:29+00:00Added an answer on May 15, 2026 at 1:34 pm
    > 'By Dhiraj Bajracharya '2010 Sub
    > getHeaddingsRecursive(arange As Range)
    > If MainHeading <> "" Then Exit Sub On
    > Error GoTo err
    >     If Subheading = "" Then
    >         If arange.Paragraphs(1).OutlineLevel =
    > WdOutlineLevel.wdOutlineLevel2 Then
    >             Subheading = arange.Text
    >             Exit Sub
    >         End If
    >     End If
    >     If arange.Paragraphs(1).OutlineLevel =
    > WdOutlineLevel.wdOutlineLevel1 Then
    >          MainHeading = arange.Text
    >     End If    Call getHeaddingsRecursive(arange.Previous(wdParagraph,
    > 1)) err: End Sub
    

    This recursive function works and the output is stored in heading and subheading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know a way to display code in Microsoft Word documents that preserves
I have a VBA macro for Microsoft Word that I am trying to improve.
I am working with VBA, in Microsoft Office 2007 and 2003 (Word specifically). What
Im working with vb.net and microsoft word using Microsoft.Office.Interop.Word and everything is fine. My
I'm working on creating a macro in Microsoft Word (2007) for a document that
I have an issue working with Microsoft.Build.BuildEngine which supposed to get fixed modifing my
I am working on a Windows (Microsoft Visual C++ 2005) application that uses several
I am working on a document that requires a user to upload a Microsoft
I'm building some Word 2003 macro that have to be put in the %APPDATA%\Microsoft\Word\Startup
I'm working on a Microsoft word 2007 Document. my Objectives are to fill :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.