Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-07-2013, 03:24 PM
macropod's Avatar
macropod macropod is offline Find and Replace using Excel range Windows 7 64bit Find and Replace using Excel range Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
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 Donna,

OK, lets go through the issues one at a time:
1. Should there always a colon after SSN/SSID when it is followed by an SSN/SSID number?
2. Should there is always one space, or two spaces before the SSN/SSID number?
3. Should the space(s) between SSN/SSID and the SSN/SSID number be non-breaking, so as to ensure the SSN/SSID stays on the same line as its number number?
4. Should the hyphens within the SSN/SSID number be non-breaking, so as to ensure all parts of the SSN/SSID number stay on the same line?



At the moment, my code's answers to these questions is:
1. Yes
2. One space
3. Yes
4. Yes

If I understand what you're saying, your answers would be:
1. No. If there's a colon, leave it; if there isn't, don't add one.
2. ???
3. Yes
4. Yes

Re:
Quote:
I had to change the hyphen because it was putting in the long hyphen and I only needed the short one
The hyphen that was being inserted is the non-breaking kind. It is the same length as a normal one, but looks longer when Word is displaying formatting.

Chr(#) tell the code to use an ASCII character value. Chr(30) is a non-breaking hyphen and Chr(160) is a non-breaking space.

You asked:
Quote:
If I add an extra space inside the brackets will it do both a colon and two spaces?? That would be cleaner code-wise.
a Find expression like "SSN[: ^0160]{1,}[0-9]{9}>" will find SSN followed by at least one colon or space (breaking or non-breaking), then a 9-digit number. So, it will find 'SSN:123456789', 'SSN: 123456789', 'SSN 123456789', 'SSN 123456789', 'SSN: 123456789', etc, regardless of how many breaking or non-breaking spaces there are, provided there is at least one colon or a space between the SSN and its number.

You also asked:
Quote:
Also, where do I put the code to format the text to Arial, size 11, left-justified?
That depends on what it is you want to do that to. IMHO, though, it would be better to define a Style that way and apply the Style rather than overriding an existing Style's formatting.

As for:
Quote:
The macro runs with the track changes code commented out but if I remove the apostrophes to activate the code then it spits back this line as out of range:
...
At this point we may have gotten around the track changes but it's a matter of principal. Sometimes it will work and then other times it breaks down and I have to exit word and start fresh.
You're evidently still partially working with a previous iteration of the code and the mixing of the two versions might be behind the problem. In any event, my most recent version (above) is much 'smarter' in its processing of the dates.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
excel 2007, find and replace, vba in microsoft word



Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste special an Excel range into Outlook as an Excel Worksheet charlesh3 Excel Programming 3 02-04-2013 04:33 PM
Find and Replace using Excel range Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
Find and Replace using Excel range Is there a way to use "find/replace" to find italics words? slayda Word 3 09-14-2011 02:16 PM
Find and Replace using Excel range Help with find and replace or query and replace shabbaranks Excel 4 03-19-2011 08:38 AM
Find and Replace within range anil3b2 Word VBA 3 12-01-2010 02:35 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:49 PM.


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