Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Index

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthias - 11 May 2008 15:17 GMT
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
Doug Robbins - Word MVP - 11 May 2008 22:45 GMT
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.

Signature

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

>I want to index a book in word - and there are already hundreds of
>exisiting
[quoted text clipped - 10 lines]
>
> Matthias
Matthias - 12 May 2008 16:11 GMT
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>.

> I am not really clear about what is actually in the document -
>
[quoted text clipped - 27 lines]
> >
> > Matthias
Doug Robbins - Word MVP - 13 May 2008 07:19 GMT
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

Signature

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

> Thanks for your answer.
> Here is an example, with in total three index entries (two with only main
[quoted text clipped - 36 lines]
>> >
>> > Matthias
Matthias - 13 May 2008 08:53 GMT
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!

> The following code should convert entries such as that to XE field codes:
>
[quoted text clipped - 61 lines]
> >> >
> >> > Matthias
Klaus Linke - 13 May 2008 12:20 GMT
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
Matthias - 13 May 2008 14:02 GMT
Klaus,

thank you thousand times, wonderful, it works perfectly!

Matthias

> Hi Matthias,
>
[quoted text clipped - 9 lines]
> Regards,
> Klaus

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.