How to set a range within a paragraph 
Author Message
 How to set a range within a paragraph

Hi,
I can set a paragraph as a range:  Set oParaRange = oParagraph.Range

I can look at that range and determine if and where a particular character
is:  If InStr(1, oParaRange, Chr(9)) Then

And where the paragraph marker is:  InStr(1, oParaRange, Chr(13))

But I cannot for the life of me figure out how to set a range within that
paragraph that starts with the character after chr(9) and ends with the
character before chr(13).

Apparently, when I try to set my range:  
vFirstPos= InStr(1, oParaRange, Chr(9))
vLastPos=InStr(1, oParaRange, Chr(13))
oRangeTest.SetRange Start:=vFirstPos, End:=vLastPos

It looks to the start of the document for the character positions instead
of the start of the document!!

Is that true?  I am getting gibberish as oRangeTest.text instead of the
text that I can plainly see is there.

If anyone can shed some light on this question, I would truly appreciate
it.

Sincerely,
Cathy Hendricks



Mon, 23 Jun 2003 00:26:38 GMT  
 How to set a range within a paragraph

Hi,
I can set a paragraph as a range:  Set oParaRange = oParagraph.Range

I can look at that range and determine if and where a particular character
is:  If InStr(1, oParaRange, Chr(9)) Then

And where the paragraph marker is:  InStr(1, oParaRange, Chr(13))

But I cannot for the life of me figure out how to set a range within that
paragraph that starts with the character after chr(9) and ends with the
character before chr(13).

Apparently, when I try to set my range:  
vFirstPos= InStr(1, oParaRange, Chr(9)) + 1
vLastPos=InStr(1, oParaRange, Chr(13)) - 1
oRangeTest.SetRange Start:=vFirstPos, End:=vLastPos

It looks to the start of the document for the character positions instead
of the start of the document!!

Is that true?  I am getting gibberish as oRangeTest.text instead of the
text that I can plainly see is there.

If anyone can shed some light on this question, I would truly appreciate
it.

Sincerely,
Cathy Hendricks



Mon, 23 Jun 2003 00:31:52 GMT  
 How to set a range within a paragraph
Hi Cathy,

The first position of the range is not equal to the position of the tab
character in the range, vFirstPos will return the position in the subrange
(the range of the paragraph) and you won't need to search for chr(13) since
this will always be the last character of a paragraph (that's why it IS a
paragraph ;-)
See this code as an example:

-----------------------------------------------
Dim oParagraph As Paragraph
Dim oParaRange As Range
Dim lStart As Long

  For Each oParagraph In ActiveDocument.Paragraphs
    lStart = InStr(1, oParagraph.Range.Text, Chr(9), vbTextCompare)
    If lStart > 0 Then
      Set oParaRange = oParagraph.Range.Duplicate
      oParaRange.Start = oParagraph.Range.Start + lStart
      oParaRange.Select
    End If
  Next
  Set oParagraph = Nothing
  Set oParaRange = Nothing
-----------------------------------------------

Hope this helps,
regards,
Astrid

So that all can benefit from the discussion,
please post all followups to the newsgroup.

Visit the MVP Word FAQ site at http://www.mvps.org/word/
For direct access to all Microsoft newsgroups:



Quote:
> Hi,
> I can set a paragraph as a range:  Set oParaRange = oParagraph.Range

> I can look at that range and determine if and where a particular character
> is:  If InStr(1, oParaRange, Chr(9)) Then

> And where the paragraph marker is:  InStr(1, oParaRange, Chr(13))

> But I cannot for the life of me figure out how to set a range within that
> paragraph that starts with the character after chr(9) and ends with the
> character before chr(13).

> Apparently, when I try to set my range:
> vFirstPos= InStr(1, oParaRange, Chr(9))
> vLastPos=InStr(1, oParaRange, Chr(13))
> oRangeTest.SetRange Start:=vFirstPos, End:=vLastPos

> It looks to the start of the document for the character positions instead
> of the start of the document!!

> Is that true?  I am getting gibberish as oRangeTest.text instead of the
> text that I can plainly see is there.

> If anyone can shed some light on this question, I would truly appreciate
> it.

> Sincerely,
> Cathy Hendricks



Mon, 23 Jun 2003 00:47:16 GMT  
 How to set a range within a paragraph
Hi Cathy,


Quote:
> Hi,
> I can set a paragraph as a range:  Set oParaRange = oParagraph.Range

> I can look at that range and determine if and where a particular character
> is:  If InStr(1, oParaRange, Chr(9)) Then

> And where the paragraph marker is:  InStr(1, oParaRange, Chr(13))

> But I cannot for the life of me figure out how to set a range within that
> paragraph that starts with the character after chr(9) and ends with the
> character before chr(13).

> Apparently, when I try to set my range:
> vFirstPos= InStr(1, oParaRange, Chr(9)) + 1
> vLastPos=InStr(1, oParaRange, Chr(13)) - 1
> oRangeTest.SetRange Start:=vFirstPos, End:=vLastPos

> It looks to the start of the document for the character positions instead
> of the start of the document!!

That's exactly right. You need to offset by the starting position of
oParaRange. Try this instead

vFirstPos = InStr(1, oParaRange, Chr(9)) + 1
vLastPos = InStr(1, oParaRange, Chr(13)) - 1
Set oRangeTest = oParaRange.Duplicate
oRangeTest.SetRange Start:=vFirstPos + oParaRange.Start - 1, _
        End:=vLastPos + oParaRange.Start

Quote:

> Is that true?  I am getting gibberish as oRangeTest.text instead of the
> text that I can plainly see is there.

Yes, because you have set oRangeTest to the start of the document

Quote:

> If anyone can shed some light on this question, I would truly appreciate
> it.

Hope the code helps.

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email



Mon, 23 Jun 2003 00:54:58 GMT  
 How to set a range within a paragraph
Astrid,  Thank you for your help.  But, I am a never ending font of
questions (at least this morning).

I am cycling through each paragraph attaching an ever changing number of
hyper links to text.
The list could look like this for example:

dogs chr(9) SU 01-10-00 CE EM 05-00-02 AL 00-02-11 chr(13)
cats and rats chr(9) AL 71-01-33 KJ 08-99-22 chr(13)

the references are formatted in one of two formats:
XX 99-99-99 or XX EM 99-99-99

There could be one of these references or 50.

I like your method of oParaRange.Start = oParagraph.Range.Start + lStart
But what happens when IStart is greater than the position of chr(13) for
that paragraph?

So I test for that...  
Where (IStart = IStart+11) or (IStart = IStart+14) depending on the group
that just got it's hyperlink:

if (oParagraph.Range.Start + lStart) < oParaRange.End) then ....

But, when I try to run this the program gives me a message "Fields nested
to deeply" and Word hangs up.

I was successful in attaching hyperlinks to the references in this index
when I was just looking at the last reference in the list.  Do you think
this is a problem with the number of index references on a line?

If so, I guess the next step is to copy the field values as text into
another document and run the thing against the new document.

Does any of this make sense?  I'm getting sad, 'cause I thought I was just
cleaning up syntax problems.  Now it's looking almost impossible again.

Thanks for your help.

Sincerely, Cathy Hendricks



Mon, 23 Jun 2003 01:38:59 GMT  
 How to set a range within a paragraph
Cathy,

Could you please explain to me what it is what you do with this text and why
you can't use Search and Replace with wildcards?

For XX 99-99-99 use
    ([!0-9]{2}) ([0-9]{2})(-)([0-9]{2})(-)([0-9]{2})
For the XX EM 99-99-99 use:
    ([!0-9]{2}) ([!0-9]{2}) ([0-9]{2})(-)([0-9]{2})(-)([0-9]{2})
as searchtext

([!0-9]{2}) means any two characters that are no numbers
([0-9]{2}) two numbers
(-) -

Hope this helps,
regards,
Astrid

So that all can benefit from the discussion,
please post all followups to the newsgroup.

Visit the MVP Word FAQ site at http://www.mvps.org/word/
For direct access to all Microsoft newsgroups:



Quote:
> Astrid,  Thank you for your help.  But, I am a never ending font of
> questions (at least this morning).

> I am cycling through each paragraph attaching an ever changing number of
> hyper links to text.
> The list could look like this for example:

> dogs chr(9) SU 01-10-00 CE EM 05-00-02 AL 00-02-11 chr(13)
> cats and rats chr(9) AL 71-01-33 KJ 08-99-22 chr(13)

> the references are formatted in one of two formats:
> XX 99-99-99 or XX EM 99-99-99

> There could be one of these references or 50.

> I like your method of oParaRange.Start = oParagraph.Range.Start + lStart
> But what happens when IStart is greater than the position of chr(13) for
> that paragraph?

> So I test for that...
> Where (IStart = IStart+11) or (IStart = IStart+14) depending on the group
> that just got it's hyperlink:

> if (oParagraph.Range.Start + lStart) < oParaRange.End) then ....

> But, when I try to run this the program gives me a message "Fields nested
> to deeply" and Word hangs up.

> I was successful in attaching hyperlinks to the references in this index
> when I was just looking at the last reference in the list.  Do you think
> this is a problem with the number of index references on a line?

> If so, I guess the next step is to copy the field values as text into
> another document and run the thing against the new document.

> Does any of this make sense?  I'm getting sad, 'cause I thought I was just
> cleaning up syntax problems.  Now it's looking almost impossible again.

> Thanks for your help.

> Sincerely, Cathy Hendricks



Tue, 24 Jun 2003 02:23:52 GMT  
 How to set a range within a paragraph

Astrid:  I would love to explain this to you.  Especially since these
explanations help me figure out the problem, as well.

Here it goes:

We have an index that looks somewhat like this:

cats
  fur   [TAB]        XX 99-99-99
dogs     [TAB]  CE EM 99-99-99. XX 99-99-99

It goes on for miles with any number of references in either of those two
formats for each topic always following a chr(9).  I just an hour ago
discovered that when there are multiple references, they are separated by a
period and a space.

I've written the module that builds this index.  But what we want to do
now, is post it on our Intranet.  They want the references to be hyperlinks
to the documents that cover the topics (which are really nothing to do with
dogs or cats)

So, I've been working on identifying each mini-range to use as the anchor
in the Add hyperlink command.

I've actually got that part done.  I can run this thing and manipulate the
fonts, and so I know that I am now  identifying the mini-ranges accurately.
 The program moves very quickly when it is just changing the fonts.

But now I have a new problem.  It won't move past adding the first
hyperlink.  It just grinds and grinds.  When I CTRL BRK, the very first
hyperlink is there but none of the others.  Since I know the program will
move through the document correctly (as tested by the font changes, and
some msgboxes), I'm pretty sure the problem with the syntax of the
hyperlink command.  But, it looks ok to me (and after the break, the
hyperlink that is left on the very first reference correctly links to the
document.)

So, again, I'm stumped.   Here's the hyperlink code (pararange is the range
that Identifies the current reference):

                vFullDocument = cPath & vDocument & cType
                oIndex.Hyperlinks.Add Anchor:=oParaRange,
Address:=vFullDocument
                oParaRange.Font.Italic = True

if I comment out the hyperlink line, the whole thing runs correctly and
turns makes the reference italic.

I truly appreciate your help and interest.
Sincerely,
Cathy Hendricks


Quote:
> Cathy,

> Could you please explain to me what it is what you do with this text and
why
> you can't use Search and Replace with wildcards?

> For XX 99-99-99 use
>     ([!0-9]{2}) ([0-9]{2})(-)([0-9]{2})(-)([0-9]{2})
> For the XX EM 99-99-99 use:
>     ([!0-9]{2}) ([!0-9]{2}) ([0-9]{2})(-)([0-9]{2})(-)([0-9]{2})
> as searchtext

> ([!0-9]{2}) means any two characters that are no numbers
> ([0-9]{2}) two numbers
> (-) -

> Hope this helps,
> regards,
> Astrid

> So that all can benefit from the discussion,
> please post all followups to the newsgroup.

> Visit the MVP Word FAQ site at http://www.mvps.org/word/
> For direct access to all Microsoft newsgroups:



> > Astrid,  Thank you for your help.  But, I am a never ending font of
> > questions (at least this morning).

> > I am cycling through each paragraph attaching an ever changing number
of
> > hyper links to text.
> > The list could look like this for example:

> > dogs chr(9) SU 01-10-00 CE EM 05-00-02 AL 00-02-11 chr(13)
> > cats and rats chr(9) AL 71-01-33 KJ 08-99-22 chr(13)

> > the references are formatted in one of two formats:
> > XX 99-99-99 or XX EM 99-99-99

> > There could be one of these references or 50.

> > I like your method of oParaRange.Start = oParagraph.Range.Start +
lStart
> > But what happens when IStart is greater than the position of chr(13)
for
> > that paragraph?

> > So I test for that...
> > Where (IStart = IStart+11) or (IStart = IStart+14) depending on the
group
> > that just got it's hyperlink:

> > if (oParagraph.Range.Start + lStart) < oParaRange.End) then ....

> > But, when I try to run this the program gives me a message "Fields
nested
> > to deeply" and Word hangs up.

> > I was successful in attaching hyperlinks to the references in this
index
> > when I was just looking at the last reference in the list.  Do you
think
> > this is a problem with the number of index references on a line?

> > If so, I guess the next step is to copy the field values as text into
> > another document and run the thing against the new document.

> > Does any of this make sense?  I'm getting sad, 'cause I thought I was
just
> > cleaning up syntax problems.  Now it's looking almost impossible again.

> > Thanks for your help.

> > Sincerely, Cathy Hendricks



Tue, 24 Jun 2003 03:08:33 GMT  
 How to set a range within a paragraph
SUCCESS!!

I've got it working.  It is so fast.  With the old way (in WordPerfect)
We had to spend hours keeping the master document list up-to-date.
It took over an hour to generate the index.

With this method, the Reference Document list and Index are automatically
generated, taking 2 minutes.
Then we run the program that attaches the hyperlinks, this take 3 minutes.

The whole thing takes 5 (count 'em) minutes!!

I am so e{*filter*}d, and very much appreciative of all your help.  I could not
have done it without this fine group.

Thank you,
Cathy Hendricks.



Quote:
> Astrid:  I would love to explain this to you.  Especially since these
> explanations help me figure out the problem, as well.

> Here it goes:

> We have an index that looks somewhat like this:

> cats
>   fur      [TAB]        XX 99-99-99
> dogs     [TAB]  CE EM 99-99-99. XX 99-99-99

> It goes on for miles with any number of references in either of those two
> formats for each topic always following a chr(9).  I just an hour ago
> discovered that when there are multiple references, they are separated by
a
> period and a space.

> I've written the module that builds this index.  But what we want to do
> now, is post it on our Intranet.  They want the references to be
hyperlinks
> to the documents that cover the topics (which are really nothing to do
with
> dogs or cats)

> So, I've been working on identifying each mini-range to use as the anchor
> in the Add hyperlink command.

> I've actually got that part done.  I can run this thing and manipulate
the
> fonts, and so I know that I am now  identifying the mini-ranges
accurately.
>  The program moves very quickly when it is just changing the fonts.

> But now I have a new problem.  It won't move past adding the first
> hyperlink.  It just grinds and grinds.  When I CTRL BRK, the very first
> hyperlink is there but none of the others.  Since I know the program will
> move through the document correctly (as tested by the font changes, and
> some msgboxes), I'm pretty sure the problem with the syntax of the
> hyperlink command.  But, it looks ok to me (and after the break, the
> hyperlink that is left on the very first reference correctly links to the
> document.)

> So, again, I'm stumped.   Here's the hyperlink code (pararange is the
range
> that Identifies the current reference):

>                 vFullDocument = cPath & vDocument & cType
>                 oIndex.Hyperlinks.Add Anchor:=oParaRange,
> Address:=vFullDocument
>                 oParaRange.Font.Italic = True

> if I comment out the hyperlink line, the whole thing runs correctly and
> turns makes the reference italic.

> I truly appreciate your help and interest.
> Sincerely,
> Cathy Hendricks




- Show quoted text -

Quote:
> > Cathy,

> > Could you please explain to me what it is what you do with this text
and
> why
> > you can't use Search and Replace with wildcards?

> > For XX 99-99-99 use
> >     ([!0-9]{2}) ([0-9]{2})(-)([0-9]{2})(-)([0-9]{2})
> > For the XX EM 99-99-99 use:
> >     ([!0-9]{2}) ([!0-9]{2}) ([0-9]{2})(-)([0-9]{2})(-)([0-9]{2})
> > as searchtext

> > ([!0-9]{2}) means any two characters that are no numbers
> > ([0-9]{2}) two numbers
> > (-) -

> > Hope this helps,
> > regards,
> > Astrid

> > So that all can benefit from the discussion,
> > please post all followups to the newsgroup.

> > Visit the MVP Word FAQ site at http://www.*-*-*.com/
> > For direct access to all Microsoft newsgroups:



> > > Astrid,  Thank you for your help.  But, I am a never ending font of
> > > questions (at least this morning).

> > > I am cycling through each paragraph attaching an ever changing number
> of
> > > hyper links to text.
> > > The list could look like this for example:

> > > dogs chr(9) SU 01-10-00 CE EM 05-00-02 AL 00-02-11 chr(13)
> > > cats and rats chr(9) AL 71-01-33 KJ 08-99-22 chr(13)

> > > the references are formatted in one of two formats:
> > > XX 99-99-99 or XX EM 99-99-99

> > > There could be one of these references or 50.

> > > I like your method of oParaRange.Start = oParagraph.Range.Start +
> lStart
> > > But what happens when IStart is greater than the position of chr(13)
> for
> > > that paragraph?

> > > So I test for that...
> > > Where (IStart = IStart+11) or (IStart = IStart+14) depending on the
> group
> > > that just got it's hyperlink:

> > > if (oParagraph.Range.Start + lStart) < oParaRange.End) then ....

> > > But, when I try to run this the program gives me a message "Fields
> nested
> > > to deeply" and Word hangs up.

> > > I was successful in attaching hyperlinks to the references in this
> index
> > > when I was just looking at the last reference in the list.  Do you
> think
> > > this is a problem with the number of index references on a line?

> > > If so, I guess the next step is to copy the field values as text into
> > > another document and run the thing against the new document.

> > > Does any of this make sense?  I'm getting sad, 'cause I thought I was
> just
> > > cleaning up syntax problems.  Now it's looking almost impossible
again.

> > > Thanks for your help.

> > > Sincerely, Cathy Hendricks



Tue, 24 Jun 2003 06:31:57 GMT  
 How to set a range within a paragraph
Hi Cathy,

Thanks for letting us now that you've done it. Congratulations!
Care to join with us what did the trick?

Regards,
Astrid

So that all can benefit from the discussion,
please post all followups to the newsgroup.

Visit the MVP Word FAQ site at http://www.*-*-*.com/
For direct access to all Microsoft newsgroups:



Quote:
> SUCCESS!!

> I've got it working.  It is so fast.  With the old way (in WordPerfect)
> We had to spend hours keeping the master document list up-to-date.
> It took over an hour to generate the index.

> With this method, the Reference Document list and Index are automatically
> generated, taking 2 minutes.
> Then we run the program that attaches the hyperlinks, this take 3 minutes.

> The whole thing takes 5 (count 'em) minutes!!

> I am so e{*filter*}d, and very much appreciative of all your help.  I could not
> have done it without this fine group.

> Thank you,
> Cathy Hendricks.



> > Astrid:  I would love to explain this to you.  Especially since these
> > explanations help me figure out the problem, as well.

> > Here it goes:

> > We have an index that looks somewhat like this:

> > cats
> >   fur [TAB]        XX 99-99-99
> > dogs     [TAB]  CE EM 99-99-99. XX 99-99-99

> > It goes on for miles with any number of references in either of those
two
> > formats for each topic always following a chr(9).  I just an hour ago
> > discovered that when there are multiple references, they are separated
by
> a
> > period and a space.

> > I've written the module that builds this index.  But what we want to do
> > now, is post it on our Intranet.  They want the references to be
> hyperlinks
> > to the documents that cover the topics (which are really nothing to do
> with
> > dogs or cats)

> > So, I've been working on identifying each mini-range to use as the
anchor
> > in the Add hyperlink command.

> > I've actually got that part done.  I can run this thing and manipulate
> the
> > fonts, and so I know that I am now  identifying the mini-ranges
> accurately.
> >  The program moves very quickly when it is just changing the fonts.

> > But now I have a new problem.  It won't move past adding the first
> > hyperlink.  It just grinds and grinds.  When I CTRL BRK, the very first
> > hyperlink is there but none of the others.  Since I know the program
will
> > move through the document correctly (as tested by the font changes, and
> > some msgboxes), I'm pretty sure the problem with the syntax of the
> > hyperlink command.  But, it looks ok to me (and after the break, the
> > hyperlink that is left on the very first reference correctly links to
the
> > document.)

> > So, again, I'm stumped.   Here's the hyperlink code (pararange is the
> range
> > that Identifies the current reference):

> >                 vFullDocument = cPath & vDocument & cType
> >                 oIndex.Hyperlinks.Add Anchor:=oParaRange,
> > Address:=vFullDocument
> >                 oParaRange.Font.Italic = True

> > if I comment out the hyperlink line, the whole thing runs correctly and
> > turns makes the reference italic.

> > I truly appreciate your help and interest.
> > Sincerely,
> > Cathy Hendricks



> > > Cathy,

> > > Could you please explain to me what it is what you do with this text
> and
> > why
> > > you can't use Search and Replace with wildcards?

> > > For XX 99-99-99 use
> > >     ([!0-9]{2}) ([0-9]{2})(-)([0-9]{2})(-)([0-9]{2})
> > > For the XX EM 99-99-99 use:
> > >     ([!0-9]{2}) ([!0-9]{2}) ([0-9]{2})(-)([0-9]{2})(-)([0-9]{2})
> > > as searchtext

> > > ([!0-9]{2}) means any two characters that are no numbers
> > > ([0-9]{2}) two numbers
> > > (-) -

> > > Hope this helps,
> > > regards,
> > > Astrid

> > > So that all can benefit from the discussion,
> > > please post all followups to the newsgroup.

> > > Visit the MVP Word FAQ site at http://www.*-*-*.com/
> > > For direct access to all Microsoft newsgroups:



> > > > Astrid,  Thank you for your help.  But, I am a never ending font of
> > > > questions (at least this morning).

> > > > I am cycling through each paragraph attaching an ever changing
number
> > of
> > > > hyper links to text.
> > > > The list could look like this for example:

> > > > dogs chr(9) SU 01-10-00 CE EM 05-00-02 AL 00-02-11 chr(13)
> > > > cats and rats chr(9) AL 71-01-33 KJ 08-99-22 chr(13)

> > > > the references are formatted in one of two formats:
> > > > XX 99-99-99 or XX EM 99-99-99

> > > > There could be one of these references or 50.

> > > > I like your method of oParaRange.Start = oParagraph.Range.Start +
> > lStart
> > > > But what happens when IStart is greater than the position of chr(13)
> > for
> > > > that paragraph?

> > > > So I test for that...
> > > > Where (IStart = IStart+11) or (IStart = IStart+14) depending on the
> > group
> > > > that just got it's hyperlink:

> > > > if (oParagraph.Range.Start + lStart) < oParaRange.End) then ....

> > > > But, when I try to run this the program gives me a message "Fields
> > nested
> > > > to deeply" and Word hangs up.

> > > > I was successful in attaching hyperlinks to the references in this
> > index
> > > > when I was just looking at the last reference in the list.  Do you
> > think
> > > > this is a problem with the number of index references on a line?

> > > > If so, I guess the next step is to copy the field values as text
into
> > > > another document and run the thing against the new document.

> > > > Does any of this make sense?  I'm getting sad, 'cause I thought I
was
> > just
> > > > cleaning up syntax problems.  Now it's looking almost impossible
> again.

> > > > Thanks for your help.

> > > > Sincerely, Cathy Hendricks



Tue, 24 Jun 2003 07:10:51 GMT  
 How to set a range within a paragraph
I know that several of you have helped me out with this problem (not just
in this thread, but most of the other questions from me going back for more
than a month relate to the building of this index.  The answer to my most
recent problem was (as it turned out) not a programming issue at all.  One
of the references as marked in one of the documents included in the index
was mistyped in the format XX 99-9-99 instead of XX 99-99-99.  Since my
module is looking for exactly the second format, finding the first through
the whole routine off (I'm thinking that one of the things I'll have to do
today is test for all such errors have the program report them and halt)
and sent it into an endless loop.

Anyway, these are the major steps of the entire process:

Documents to be included in the index are marked (the references in the
index always refer to the file name - XX 99-99-99) and saved all to one
folder.
When the module runs it:
1) Looks to that folder and builds a list of reference document fields for
each document in that folder.
2) Generates an index from that list.
3) Copies that index as text into it's own (new) document and saves it.
4) Cycles through each reference in the index and:
    a)  Determines which format the reference matches (XX XX 99-99-99 or XX
99-99-99) and sets the end of the range appropriately.
    b)  Stores the range that contains this reference for use as the anchor
in a hyperlink.
    c)  parces out the 4 parts of the reference and puts them together as a
filename - XX999999h.htm or XXXX999999h.htm to use as the address in a
hyperlink (Astrid - This is the biggest reason that I have to look at
exactly what characters are there and couldn't just use the locate
functions).
    d)  sets a variable to hold the value of the spot 3 positions after the
end of the current range.
    e)  adds the hyperlink to the active range.
     f)  Tests the variable stored in step (d) to see if it lies beyond the
end of the paragraph and either moves to the next paragraph or sets the
start of the next range to the value saved in step (d).
     g)  Starts again with (a).
5)  This part isn't complete.  We have to save this as an *.htm document.
But we're losing some of the formatting of the index (the{*filter*} indents
for subheadings).  So, I'm thinking that I will add 3 spaces for the
paragraphs that are sub-headings.  Either that or copy the whole thing into
tables.  But I think just adding the spaces is easiest.

If anyone would like to see the code that does any or all of this please
let me know.  I didn't include it with this note because it still needs to
be cleaned up a little (at this point, there is nothing elegant about it)
I think there are some variables that I'm not using any more and possible
some redundant activity going on.

But, since I've been asking all this obscure questions, I thought I'd pass
along some of the background.  Thank you very, very much for your help and
guidance.

Sincerely,
Cathy Hendricks



Wed, 25 Jun 2003 03:37:48 GMT  
 
 [ 15 post ] 

 Relevant Pages 

1. Return ONLY selected paragraphs within a range that includes a table

2. Setting paragraph (without CR) as Range

3. Delete range of paragraphs based on start text of paragraphs

4. Macro within a Macro setting range and printing

5. Range...Words...paragraphs...HELP

6. Paragraph.Range.Footnotes Count/Item Mismatch

7. How to convert word paragraph or range into RTF format

8. find/copy paragraphs within a document

9. text styles within a paragraph

10. Paragraphs Within Scrolling Text Boxes

11. Set location of Picture from within .rpt file opposed to .dsr within VB

12. Calculate no of days in a month within a specified date range

 

 
Powered by phpBB® Forum Software