Solved

Getting Section Index from ActiveDocument.Range

Posted on 2009-07-10
4
341 Views
Last Modified: 2012-08-13
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
Comment
Question by:rinksno1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 37

Accepted Solution

by:
Joanne M. Orzech earned 500 total points
ID: 24824892
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
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24827394
You could use:
iSecIndex = oRange.Sections(1).Index
0
 
LVL 3

Author Closing Comment

by:rinksno1
ID: 31602119
Thanks allot you made my day, Thanks again
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 24840183
Excellent!  Glad I was able to assist.  Thank you.

Joanne Orzech
MS Word MVP
EE Zone Advisor
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question