Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Wibs
 
Posts: n/a
Default Can someone please tweak my Macro?


OK, this isn't Excel, it's Word, but there is no forum for Word
comparable to this forum for Excel, and as the problem is really VBA I
thought, heh, give it a try.

I want to record a macro to help me with indexing a large book. The way
to mark an index entry is to select the text, then press the key
combination Shift+Alt+X, or on the Menu go to Insert, Index and Tables,
Mark Entry. I would rather have this in a single key, such as F12.

My first try was to select a word, such as 'Beverley', in "Beverley is
a market town in the East Riding of Yorkshire. I then recorded in a
macro the menu route. I then looked at the recorded macro, it looked
like this:

========================
Sub indexing()

ActiveWindow.ActivePane.View.ShowAll = True
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range,
Entry:="Beverley" _
, EntryAutoText:="Beverley", CrossReference:="",
CrossReferenceAutoText:= _
"", BookmarkName:="", Bold:=False, Italic:=False
End Sub
========================

I can now assign this macro to the F12 key, so far no problem.

Of course, I cannot invoke this macro for every place I want to index,
as each one would say 'Beverley'. I think I need to store the selected
text into a variable, then replace the references to Beverley in the
macro with the variable. Have I got it right?

If anyone could fill in the missing bits of code I wuld be most
grateful.

Regards, and Best Wishes for Christmas and the New Year,

Wibs


--
Wibs
------------------------------------------------------------------------
Wibs's Profile: http://www.excelforum.com/member.php...o&userid=28922
View this thread: http://www.excelforum.com/showthread...hreadid=493833

  #2   Report Post  
Posted to microsoft.public.excel.misc
pinmaster
 
Posts: n/a
Default Can someone please tweak my Macro?


Hi, I'm not an expert but try this:

Sub indexing()

ActiveWindow.ActivePane.View.ShowAll = True
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range,
Entry:=Selection _
, EntryAutoText:=Selection, CrossReference:="",
CrossReferenceAutoText:= _
"", BookmarkName:="", Bold:=False, Italic:=False
End Sub

to assing a key to your macro go to Tools/Customize/Keyboard (bottom)
then select "macros" from the list on the left then select your macro
from the Macros list and assing your key.

Hope this helps!
JG


--
pinmaster
------------------------------------------------------------------------
pinmaster's Profile: http://www.excelforum.com/member.php...fo&userid=6261
View this thread: http://www.excelforum.com/showthread...hreadid=493833

  #3   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph
 
Posts: n/a
Default Can someone please tweak my Macro?

"Wibs" wrote in message
...

OK, this isn't Excel, it's Word, but there is no forum for Word
comparable to this forum for Excel, and as the problem is really VBA I
thought, heh, give it a try.
...


If the subject is Word & VBA, what about news:microsoft.public.word.vba ?
There are numerous other MS Word newsgroups too.
--
David Biddulph


  #4   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph
 
Posts: n/a
Default Can someone please tweak my Macro?

"David Biddulph" <david(dot)biddulph(at)baesystems.com wrote in message
...
"Wibs" wrote in

message
...

OK, this isn't Excel, it's Word, but there is no forum for Word
comparable to this forum for Excel, and as the problem is really VBA I
thought, heh, give it a try.
...


If the subject is Word & VBA, what about news:microsoft.public.word.vba ?


.... or microsoft.public.word.vba.general ... or another of the same family ?

There are numerous other MS Word newsgroups too.

--
David Biddulph


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can T Get Macro To Run! Nipper New Users to Excel 2 November 4th 05 04:48 AM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM


All times are GMT +1. The time now is 02:48 AM.

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

About Us

"It's about Microsoft Excel"