A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Importing Text with Indexes



 
 
Thread Tools Display Modes
  #1  
Old July 24th, 2009, 05:38 PM posted to microsoft.public.word.docmanagement
Kevin
external usenet poster
 
Posts: 910
Default 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  
Old July 24th, 2009, 09:11 PM posted to microsoft.public.word.docmanagement
Peter T. Daniels
external usenet poster
 
Posts: 1,959
Default 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  
Old August 8th, 2009, 04:24 AM posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill
external usenet poster
 
Posts: 31,786
Default 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  
Old August 8th, 2009, 06:54 AM posted to microsoft.public.word.docmanagement
Graham Mayor
external usenet poster
 
Posts: 18,297
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.