Solved

Getting Section Index from ActiveDocument.Range

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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
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…

734 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