#1
|
|||
|
|||
macro
Hello,
I need to create word document with a macro which should check first name and last name in a way that when user place cursor before first name like James Tylor macro should create initials J.T. ! In case when another name with same initials exists like Jamie Tyler macro should create initials like J.T.(2) and so on ... Is it possible ? Thank You in advance. |
#2
|
||||
|
||||
hi doe2,
It really isn't practical for Word to try to do what you're asking, especially if the names are in different documents. This gets especially complicated even if, say, you have names in just one document and you number two or more instances of 'J.T,' then want to number another one that is between a pair that have already been numbered.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi Paul,
Thank You for fast response. There are rare situations where names with same first letters are same. Is there a way to just mark initals tha are same with an * ? |
#4
|
||||
|
||||
Hi doe2,
The problem remains, in that every time you do this, Word would have to search the entire document for potential matches. Word doesn't have some kind of in-built log to tell it that a particular string is already in use. Consider also what happens if you have Jamie Tyler, Jamie Rich Tyler and Jamie von Tyler. Even if the first two are the same person, Word wouldn't recognize it. As for the third, you don't even have two consecutive capitals
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Paul ,
than I would need only best way to replace names with initials without additional conditions ? |
#6
|
||||
|
||||
You could use a macro to go through the document, finding all strings that have the same set of capital & lower-case first letters as your selected text, extract the first letters, then prefix the strings with the initials and number each instance.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I assign a macro to a button when the macro is in my personal workbook? | foolios | Excel Programming | 2 | 07-27-2011 02:41 PM |