Solved

Getting Section Index from ActiveDocument.Range

Posted on 2009-07-10
4
334 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
  • 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

This article will show you how to use shortcut menus in the Access run-time environment.
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now