• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

Getting Section Index from ActiveDocument.Range

Hi All,

I am trying to find a way where I can get the section index of Range. THe Range I am specifying is actually a Page which I am getting using

 Set oRange = _
            ActiveDocument.Range _
            (Start:=ActiveDocument.Bookmarks("\page").Start, _
            End:=ActiveDocument.Bookmarks("\page").End - 1)

So essentially I am trying to get a section of a page which I am on. For your information I know how to get the total section count of a document but here I want to know which is the section where my range currently is.
Could any expert help me on this as I am not so well in VBAprogramming
0
rinksno1
Asked:
rinksno1
  • 2
1 Solution
 
Joanne M. OrzechManager, Document Services CenterCommented:
This should tell you what section your cursor is in:

Sub SectionTest()
Sec = Selection.Information(wdActiveEndSectionNumber)
MsgBox ("You are currently in Section " & Sec & " of the document.")
End Sub

Open in new window

0
 
GrahamSkanRetiredCommented:
You could use:
iSecIndex = oRange.Sections(1).Index
0
 
rinksno1Author Commented:
Thanks allot you made my day, Thanks again
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Excellent!  Glad I was able to assist.  Thank you.

Joanne Orzech
MS Word MVP
EE Zone Advisor
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now