If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Importing Text with Indexes
I want to import a text file, from a database, that contains the coding to
setup indexes in Word. When the text file contains { XE "Bloggs" \f"n" } Word does not recognise it as an index. Is there a special control character I have to insert into the text file so Word will index the documnet correctly? |
#2
|
|||
|
|||
Importing Text with Indexes
The index markers ({XE }) are field codes, inserted as such, not just
brace-characters. If it's really a .txt file, then the index markers won't carry over. On Jul 24, 12:38*pm, Kevin wrote: I want to import a text file, from a database, that contains the coding to setup indexes in Word. When the text file contains { XE "Bloggs" \f"n" } Word does not recognise it as an index. Is there a special control character I have to insert into the text file so Word will index the documnet correctly? |
#3
|
|||
|
|||
Importing Text with Indexes
But it should be possible for some clever person to write a macro that
searches for text surrounded by braces, removes the braces, and then converts the selected text to a field. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Peter T. Daniels" wrote in message ... The index markers ({XE }) are field codes, inserted as such, not just brace-characters. If it's really a .txt file, then the index markers won't carry over. On Jul 24, 12:38 pm, Kevin wrote: I want to import a text file, from a database, that contains the coding to setup indexes in Word. When the text file contains { XE "Bloggs" \f"n" } Word does not recognise it as an index. Is there a special control character I have to insert into the text file so Word will index the documnet correctly? |
#4
|
|||
|
|||
Importing Text with Indexes
Not that clever
Sub ReformatXE() Dim rXE As Range Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(findText:="\{ XE*\}", _ MatchWildcards:=True, _ Wrap:=wdFindStop, Forward:=True) = True Set rXE = Selection.Range rXE.Text = Replace(rXE, "{ XE", "") rXE.Text = Replace(rXE, " }", "") MsgBox rXE rXE.Fields.Add rXE, _ wdFieldIndexEntry, _ rXE.Text, _ False Loop End With End Sub If the fields are entered as text as { XE "Bloggs" \f"n" }, the above should do the job http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Suzanne S. Barnhill wrote: But it should be possible for some clever person to write a macro that searches for text surrounded by braces, removes the braces, and then converts the selected text to a field. On Jul 24, 12:38 pm, Kevin wrote: I want to import a text file, from a database, that contains the coding to setup indexes in Word. When the text file contains { XE "Bloggs" \f"n" } Word does not recognise it as an index. Is there a special control character I have to insert into the text file so Word will index the documnet correctly? |
Thread Tools | |
Display Modes | |
|
|