Sunday, July 20, 2008

Convert Selected Text as Sentence Case (ICLC) Index Entry

Mark Selected Text as an Index Entry (Word VBA)

The following code will be useful in marking the selected text as an Index Entry. The index entry will be in Sentence Case irrespective of the selected text

Sub IndexInsertEntryICLC_Word()

If Len(Selection.Text) > 1 Then

SelectedText = UCase(Left(Selection.Text, 1)) & LCase(Right(Selection.Text, Len(Selection.Text) - 1))

ActiveDocument.Indexes.MarkEntry(Range:=Selection.Range, Entry:=SelectedText, _

EntryAutoText:=SelectedText, CrossReference:="", CrossReferenceAutoText:="", _

BookmarkName:="", Bold:=False, Italic:=False)

Else

idexmsg = MsgBox("Please select the text and use this command!!", vbCritical, "CE Indexer")

End If

End Sub

Inserts an XE (Index Entry) field after the specified range. The method returns a Field object representing the XE field. Copyeditors/indexers can assign a shortcut key (http://vbadud.blogspot.com/2007/06/assigning-shortcut-keys-excel-macros.html) to the macro and use it for marking indexes as they read the document


No comments:

Post a Comment

StumbleUpon
Share on Facebook
Related Posts Plugin for WordPress, Blogger...
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.