I need to find a section number and get its name to store it in a variable.

Example:
1.1 Introduction

Need to find 1.1 and then store"introduction" into a variable.

Anyone know how to do that?

Thanks!

Re: get section name by Jezebel

Jezebel
Thu Sep 07 13:54:29 CDT 2006

That's not a section name, it's a heading. How you extract it depends on how
it's marked. If it's the first level one heading in the document, iterate
the paragraphs and return the first with OutlineLevel = 1




"john smith" <tsoetanto@businessobjects.com> wrote in message
news:OUwqy3q0GHA.3656@TK2MSFTNGP04.phx.gbl...
>I need to find a section number and get its name to store it in a variable.
>
> Example:
> 1.1 Introduction
>
> Need to find 1.1 and then store"introduction" into a variable.
>
> Anyone know how to do that?
>
> Thanks!
>
>
>



Re: get section name by Jean-Guy

Jean-Guy
Thu Sep 07 13:56:33 CDT 2006

john smith was telling us:
john smith nous racontait que :

> I need to find a section number and get its name to store it in a
> variable.
> Example:
> 1.1 Introduction
>
> Need to find 1.1 and then store"introduction" into a variable.
>
> Anyone know how to do that?
>
> Thanks!

You have posted elsewhere a question that was also referring to something
you call a "section".

From those two post I can conclude that they are not sections.
A section in word is the area of text delimited by sections breaks (Insert >
Breaks > Sections...)

What you are writing about here looks like a paragraph.

Now, is
1.1 Introduction
a paragraph with a style applied that includes numbering?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org



Re: get section name by john

john
Thu Sep 07 14:02:00 CDT 2006

Yeah, I'm sorry about my terms here. It is a paragraph with numbering
involved. I just want to get the name there after the number.

Would you know how to do that?

Thank you so much!

"Jean-Guy Marcil" <NoSpam@LeaveMeAlone> wrote in message
news:Oe7ph8q0GHA.4748@TK2MSFTNGP04.phx.gbl...
> john smith was telling us:
> john smith nous racontait que :
>
>> I need to find a section number and get its name to store it in a
>> variable.
>> Example:
>> 1.1 Introduction
>>
>> Need to find 1.1 and then store"introduction" into a variable.
>>
>> Anyone know how to do that?
>>
>> Thanks!
>
> You have posted elsewhere a question that was also referring to something
> you call a "section".
>
> From those two post I can conclude that they are not sections.
> A section in word is the area of text delimited by sections breaks (Insert
> > Breaks > Sections...)
>
> What you are writing about here looks like a paragraph.
>
> Now, is
> 1.1 Introduction
> a paragraph with a style applied that includes numbering?
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>



Re: get section name by Jean-Guy

Jean-Guy
Thu Sep 07 14:21:37 CDT 2006

john smith was telling us:
john smith nous racontait que :

> Yeah, I'm sorry about my terms here. It is a paragraph with numbering
> involved. I just want to get the name there after the number.
>
> Would you know how to do that?

When you use AutoNumbering, the number itself is not part of the paragraph
range, so you can use something like this (Which removes the ¶ from the
range):

Dim rgePara As Range
Dim strParaText As String

Set rgePara = Selection.Paragraphs(1).Range
With rgePara
.MoveEnd wdCharacter, -1
strParaText = .Text
End With

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org



Re: get section name by john

john
Thu Sep 07 15:17:58 CDT 2006

Hi Jean,

Thanks for your help. Further, I'd like to find a particular numbering like
1.1 or 1.2 in TOC below Part II Test Cases
then get the name after the number.

For example in TOC:
Table Of Contents

Part I Background Information. 4

1 Overview of Feature or System under Test 4

2 Scope of Test 4

3 Assumptions and Constraints 4

4 Resources Requirements 5

4.1 Skill Requirements 5

4.2 Hardware Requirements 5

4.3 Software Requirements 5



Part II Test Cases 8

1 Add 8

2 Move 11

3 Copy 13

4 Shortcut 15



I want to find number 1 name(=Add), number 2 name(=Move) etc... and store it
in variable. Would you know how to do that?



Thanks






"Jean-Guy Marcil" <NoSpam@LeaveMeAlone> wrote in message
news:%23FURiKr0GHA.1268@TK2MSFTNGP02.phx.gbl...
> john smith was telling us:
> john smith nous racontait que :
>
>> Yeah, I'm sorry about my terms here. It is a paragraph with numbering
>> involved. I just want to get the name there after the number.
>>
>> Would you know how to do that?
>
> When you use AutoNumbering, the number itself is not part of the paragraph
> range, so you can use something like this (Which removes the ¶ from the
> range):
>
> Dim rgePara As Range
> Dim strParaText As String
>
> Set rgePara = Selection.Paragraphs(1).Range
> With rgePara
> .MoveEnd wdCharacter, -1
> strParaText = .Text
> End With
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>



Re: get section name by Jean-Guy

Jean-Guy
Fri Sep 08 06:20:36 CDT 2006

john smith was telling us:
john smith nous racontait que :

> Hi Jean,
>
> Thanks for your help. Further, I'd like to find a particular
> numbering like 1.1 or 1.2 in TOC below Part II Test Cases
> then get the name after the number.
>
> For example in TOC:
> Table Of Contents
>
> Part I Background Information. 4
>
> 1 Overview of Feature or System under Test 4
>
> 2 Scope of Test 4
>
> 3 Assumptions and Constraints 4
>
> 4 Resources Requirements 5
>
> 4.1 Skill Requirements 5
>
> 4.2 Hardware Requirements 5
>
> 4.3 Software Requirements 5
>
>
>
> Part II Test Cases 8
>
> 1 Add 8
>
> 2 Move 11
>
> 3 Copy 13
>
> 4 Shortcut 15
>
>
>
> I want to find number 1 name(=Add), number 2 name(=Move) etc... and
> store it in variable. Would you know how to do that?
>

Yes, I could, but it would take a fair amount of code.
Also, without knowing the logic involved, it is rather pointless to try to
write some code.

May I ask what is your purpose here?

Have you tried to code it yourself?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org