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
Solved

Getting Section Index from ActiveDocument.Range

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

856 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