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 / Mailmerge and Fax / February 2004

Tip: Looking for answers? Try searching our database.

Index Entry Field Code (XE), Switches & Macros

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Anhorn - 25 Jan 2004 06:54 GMT
I'm wondering if there is any way to create a macro or a
quick key (ie CTRL W) so that I can select text and
insert a field code for index entries.

The specific field codes I would like to be able to
easily inserted is:  

1)  {XE "selected text" \f "a"}
2)  {XE "selected text" \f "b"}

Any suggestions would be greatly appreciated
Michael
Peter Jamieson - 26 Jan 2004 15:20 GMT
Have a look at Autotext in Word Help (create an autotext for each thing you
want to insert often, and assign a keystroke to it).

--
Peter Jamieson - Word MVP
Word MVP web site http://word.mvps.org/

> I'm wondering if there is any way to create a macro or a
> quick key (ie CTRL W) so that I can select text and
[quoted text clipped - 8 lines]
> Any suggestions would be greatly appreciated
> Michael
Peter Jamieson - 27 Jan 2004 01:04 GMT
Sorry, failed to read the question properly. Go with Cindy's reply!

--
Peter Jamieson - Word MVP
Word MVP web site http://word.mvps.org/

> Have a look at Autotext in Word Help (create an autotext for each thing you
> want to insert often, and assign a keystroke to it).
[quoted text clipped - 15 lines]
> > Any suggestions would be greatly appreciated
> > Michael
Cindy M  -WordMVP- - 26 Jan 2004 17:02 GMT
Hi Michael,

> I'm wondering if there is any way to create a macro or a
> quick key (ie CTRL W) so that I can select text and
> insert a field code for index entries.

Something along these lines should work:

Sub InsertXEfield()
   Dim szEntry as String
   szEntry = Selection.Range.Text
   Selection.Collapse wdCollapseEnd
 ActiveDocument.Fields.Add _
   Range:=Selection.Range, _
   Text:=" XE " & Chr$(34) & _
   szEntry & Chr$(34) & " /f" _
   & Chr$(34) & "a" & Chr$(34),_
   PreserveFormatting:=False
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:-)
Michael - 10 Feb 2004 17:39 GMT
Hi Cindy,

Thanks for this.  I tried copying and pasting this into a
Macro and wasn't able to get it to work.  I don't have
any background in programming so am not able to debug
it.  But I can tell you that when I pasted it everything
from "ActiveDocument.Fields.Add _" and on was red.  Any
help you could give me would be most appreciated.

Thanks
Michael

>-----Original Message-----
>Hi Michael,
[quoted text clipped - 28 lines]
>
>.
Cindy M  -WordMVP- - 11 Feb 2004 18:29 GMT
Hi Michael,

whoops! Looks like something got "lost in translation". I
did some editing to make sure it wouldn't break in the
wrong place due to wrapping, and it looks like I deleted
something I ought not have! Sorry about that. Try this

Sub InsertXEfield()
   Dim szEntry As String
   szEntry = Selection.Range.Text
   Selection.Collapse wdCollapseEnd
 ActiveDocument.Fields.Add _
   Range:=Selection.Range, _
   Type:=wdFieldEmpty, _
   Text:=" XE " & Chr$(34) & _
   szEntry & Chr$(34) & " /f" _
   & Chr$(34) & "a" & Chr$(34), _
   PreserveFormatting:=False
End Sub

> I tried copying and pasting this into a
> Macro and wasn't able to get it to work.  I don't have
> any background in programming so am not able to debug
> it.  But I can tell you that when I pasted it everything
> from "ActiveDocument.Fields.Add _" and on was red.  Any
> help you could give me would be most appreciated.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:-)
Michael - 11 Feb 2004 22:31 GMT
Brilliant!

Thank you very much!
Michael
>-----Original Message-----
>Hi Michael,
[quoted text clipped - 35 lines]
>
>.
 
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.