I want to index a book in word - and there are already hundreds of exisiting
index entries in the text, produced an older programm.

There are two forms (both nomal text in the file):
- <$Imainentry>
- <$mainetry;subentry>.

Can this be achieved in VBA? Replace these existing text fields with word
index fields {XE }?

Thanks for every answer/help!

Matthias

Re: Index by Doug

Doug
Sun May 11 14:45:35 PDT 2008

I am not really clear about what is actually in the document -

There are two forms (both nomal text in the file):
- <$Imainentry>
- <$mainetry;subentry>.

Can you paste a chunk of the text that contains such items into a message so
that I, at least, can be sure what you have to start with.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Matthias" <matthiashb@hotmail.com> wrote in message
news:g06v1p$ns5$02$1@news.t-online.com...
>I want to index a book in word - and there are already hundreds of
>exisiting
> index entries in the text, produced an older programm.
>
> There are two forms (both nomal text in the file):
> - <$Imainentry>
> - <$mainetry;subentry>.
>
> Can this be achieved in VBA? Replace these existing text fields with word
> index fields {XE }?
>
> Thanks for every answer/help!
>
> Matthias
>
>



Re: Index by Matthias

Matthias
Mon May 12 08:11:21 PDT 2008

Thanks for your answer.
Here is an example, with in total three index entries (two with only main
entry, the third with additional subentry):

The currently relevant results <$Iresults;relevant> from this development
<$Idevelopment> are the following approvals <$Iapprovals>.




"Doug Robbins - Word MVP" <dkr@REMOVECAPSmvps.org> schrieb im Newsbeitrag
news:uFI$cB7sIHA.4912@TK2MSFTNGP03.phx.gbl...
> I am not really clear about what is actually in the document -
>
> There are two forms (both nomal text in the file):
> - <$Imainentry>
> - <$mainetry;subentry>.
>
> Can you paste a chunk of the text that contains such items into a message
so
> that I, at least, can be sure what you have to start with.
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "Matthias" <matthiashb@hotmail.com> wrote in message
> news:g06v1p$ns5$02$1@news.t-online.com...
> >I want to index a book in word - and there are already hundreds of
> >exisiting
> > index entries in the text, produced an older programm.
> >
> > There are two forms (both nomal text in the file):
> > - <$Imainentry>
> > - <$mainetry;subentry>.
> >
> > Can this be achieved in VBA? Replace these existing text fields with
word
> > index fields {XE }?
> >
> > Thanks for every answer/help!
> >
> > Matthias
> >
> >
>
>



Re: Index by Doug

Doug
Mon May 12 23:19:11 PDT 2008

The following code should convert entries such as that to XE field codes:

Dim myrange As Range, Code As String
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(Findtext:="\<$I*\>", Forward:=True, _
MatchWildcards:=True, Wrap:=wdFindStop) = True
Set myrange = Selection.Range
myrange.Text = Replace(myrange.Text, ";", ":")
Code = Mid(myrange, 4, Len(myrange) - 4)
myrange.Text = ""
ActiveDocument.Fields.Add myrange, wdFieldEmpty, "XE " &
Code
Loop
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Matthias" <matthiashb@hotmail.com> wrote in message
news:g09mgl$lli$00$1@news.t-online.com...
> Thanks for your answer.
> Here is an example, with in total three index entries (two with only main
> entry, the third with additional subentry):
>
> The currently relevant results <$Iresults;relevant> from this development
> <$Idevelopment> are the following approvals <$Iapprovals>.
>
>
>
>
> "Doug Robbins - Word MVP" <dkr@REMOVECAPSmvps.org> schrieb im Newsbeitrag
> news:uFI$cB7sIHA.4912@TK2MSFTNGP03.phx.gbl...
>> I am not really clear about what is actually in the document -
>>
>> There are two forms (both nomal text in the file):
>> - <$Imainentry>
>> - <$mainetry;subentry>.
>>
>> Can you paste a chunk of the text that contains such items into a message
> so
>> that I, at least, can be sure what you have to start with.
>>
>> --
>> Hope this helps.
>>
>> Please reply to the newsgroup unless you wish to avail yourself of my
>> services on a paid consulting basis.
>>
>> Doug Robbins - Word MVP
>>
>> "Matthias" <matthiashb@hotmail.com> wrote in message
>> news:g06v1p$ns5$02$1@news.t-online.com...
>> >I want to index a book in word - and there are already hundreds of
>> >exisiting
>> > index entries in the text, produced an older programm.
>> >
>> > There are two forms (both nomal text in the file):
>> > - <$Imainentry>
>> > - <$mainetry;subentry>.
>> >
>> > Can this be achieved in VBA? Replace these existing text fields with
> word
>> > index fields {XE }?
>> >
>> > Thanks for every answer/help!
>> >
>> > Matthias
>> >
>> >
>>
>>
>
>



Re: Index by Matthias

Matthias
Tue May 13 00:53:29 PDT 2008

Dear Doug,

thank you so much for your help, it works! I´ve got only one problem, all
replaced index entries look like following:

{ XE approvals \* MERGEFORMAT }

Can you give me a tip how the string \* MERGEFORMAT can be avoided?

Thanks in advance for your fantastic work!



"Doug Robbins - Word MVP" <dkr@REMOVECAPSmvps.org> schrieb im Newsbeitrag
news:Oh5pJFMtIHA.1872@TK2MSFTNGP04.phx.gbl...
> The following code should convert entries such as that to XE field codes:
>
> Dim myrange As Range, Code As String
> Selection.HomeKey wdStory
> Selection.Find.ClearFormatting
> With Selection.Find
> Do While .Execute(Findtext:="\<$I*\>", Forward:=True, _
> MatchWildcards:=True, Wrap:=wdFindStop) = True
> Set myrange = Selection.Range
> myrange.Text = Replace(myrange.Text, ";", ":")
> Code = Mid(myrange, 4, Len(myrange) - 4)
> myrange.Text = ""
> ActiveDocument.Fields.Add myrange, wdFieldEmpty, "XE " &
> Code
> Loop
> End With
>
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "Matthias" <matthiashb@hotmail.com> wrote in message
> news:g09mgl$lli$00$1@news.t-online.com...
> > Thanks for your answer.
> > Here is an example, with in total three index entries (two with only
main
> > entry, the third with additional subentry):
> >
> > The currently relevant results <$Iresults;relevant> from this
development
> > <$Idevelopment> are the following approvals <$Iapprovals>.
> >
> >
> >
> >
> > "Doug Robbins - Word MVP" <dkr@REMOVECAPSmvps.org> schrieb im
Newsbeitrag
> > news:uFI$cB7sIHA.4912@TK2MSFTNGP03.phx.gbl...
> >> I am not really clear about what is actually in the document -
> >>
> >> There are two forms (both nomal text in the file):
> >> - <$Imainentry>
> >> - <$mainetry;subentry>.
> >>
> >> Can you paste a chunk of the text that contains such items into a
message
> > so
> >> that I, at least, can be sure what you have to start with.
> >>
> >> --
> >> Hope this helps.
> >>
> >> Please reply to the newsgroup unless you wish to avail yourself of my
> >> services on a paid consulting basis.
> >>
> >> Doug Robbins - Word MVP
> >>
> >> "Matthias" <matthiashb@hotmail.com> wrote in message
> >> news:g06v1p$ns5$02$1@news.t-online.com...
> >> >I want to index a book in word - and there are already hundreds of
> >> >exisiting
> >> > index entries in the text, produced an older programm.
> >> >
> >> > There are two forms (both nomal text in the file):
> >> > - <$Imainentry>
> >> > - <$mainetry;subentry>.
> >> >
> >> > Can this be achieved in VBA? Replace these existing text fields with
> > word
> >> > index fields {XE }?
> >> >
> >> > Thanks for every answer/help!
> >> >
> >> > Matthias
> >> >
> >> >
> >>
> >>
> >
> >
>
>



Re: Index by Klaus

Klaus
Tue May 13 04:20:57 PDT 2008

Hi Matthias,

Replace the line starting with ActiveDocument.Fields.Add:

ActiveDocument.Fields.Add _
Range:=myrange, _
Type:=wdFieldEmpty, _
Text:="XE " & Chr(34) & Code & Chr(34), _
PreserveFormatting:=False
' The last line gets rid of \* MERGEFORMAT

Regards,
Klaus

Re: Index by Matthias

Matthias
Tue May 13 06:03:40 PDT 2008

Klaus,

thank you thousand times, wonderful, it works perfectly!

Matthias


"Klaus Linke" <info@fotosatz-kaufmann.de> schrieb im Newsbeitrag
news:eswxstOtIHA.4848@TK2MSFTNGP05.phx.gbl...
> Hi Matthias,
>
> Replace the line starting with ActiveDocument.Fields.Add:
>
> ActiveDocument.Fields.Add _
> Range:=myrange, _
> Type:=wdFieldEmpty, _
> Text:="XE " & Chr(34) & Code & Chr(34), _
> PreserveFormatting:=False
> ' The last line gets rid of \* MERGEFORMAT
>
> Regards,
> Klaus