Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2012, 11:30 AM
doe2 doe2 is offline macro Windows XP macro Office 2003
Novice
macro
 
Join Date: Jun 2012
Posts: 3
doe2 is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 06-05-2012, 11:48 AM
macropod's Avatar
macropod macropod is offline macro Windows 7 64bit macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 06-05-2012, 12:05 PM
doe2 doe2 is offline macro Windows XP macro Office 2003
Novice
macro
 
Join Date: Jun 2012
Posts: 3
doe2 is on a distinguished road
Default

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 * ?
Reply With Quote
  #4  
Old 06-05-2012, 12:12 PM
macropod's Avatar
macropod macropod is offline macro Windows 7 64bit macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #5  
Old 06-05-2012, 12:28 PM
doe2 doe2 is offline macro Windows XP macro Office 2003
Novice
macro
 
Join Date: Jun 2012
Posts: 3
doe2 is on a distinguished road
Default

Paul ,
than I would need only best way to replace names with initials without additional conditions ?
Reply With Quote
  #6  
Old 06-05-2012, 04:52 PM
macropod's Avatar
macropod macropod is offline macro Windows 7 64bit macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

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

Other Forums: Access Forums

All times are GMT -7. The time now is 05:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft