Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-17-2017, 12:22 PM
qubie qubie is offline Wild Card Problem (Word 2007) Windows 7 64bit Wild Card Problem (Word 2007) Office 2007
Novice
Wild Card Problem (Word 2007)
 
Join Date: Aug 2016
Posts: 24
qubie is on a distinguished road
Default Wild Card Problem (Word 2007)

Greetings,

I am having trouble with "^13" in a wild card macro with which I am working.

I am applying the macro to search through text that has - scattered throughout - collections of numbers that are separated by two dashes, e.g., "4-5-708". These patterns in the text are not identical; in other words, within a single record, I may find "55-1-1" as well as "55-11-111", as well as "5-1-111", and so on.

I am interested in highlighting each collection of numbers, if any, that begins a paragraph of text.

Here is a brief snippet from the macro that is supposed to look for, e.g., "4-5-201" at the beginning of a text paragraph, highlight it, and add bold font to it:

Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Bold = True
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "^13[0-9]-[0-9]-[0-9]{2,3}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

My difficulty is that the foregoing does not work; it should, but it does not. I believe the culprit is "^13", but I am unable to find a working equivalent or work-around.

When I search the record for "[0-9]-[0-9]-[0-9]{2,3}", I get results, but this search is not confined only to patterns that lead a paragraph of the content.

When I wild-card-search the record for "^13", I also get results; indeed, Word appears to land upon the hard returns that precede the number patterns of interest.

When I make use of "^p" and a literal number that I know is in the text (e.g., "4-5-790"), I also get results.

When, however, I undertake to use "^13[0-9]-[0-9]-[0-9]{2,3}", Word finds nothing in the record. That is odd to me, but perhaps I am missing something.

I appreciate your attention and hope you may have suggestions.



Regards,

q.
Reply With Quote
 

Tags
macros don't work, word 2007



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use wild card in VBA for Advance Filter? LearnerExcel Excel Programming 1 10-09-2017 12:27 AM
Wild Card Problem (Word 2007) find with wild cards and add into CC sylvio Word VBA 2 09-04-2017 01:00 AM
Wild Card Problem (Word 2007) Question about find and replace wild cards catherineliang Word 1 07-21-2014 09:42 PM
Wild card to highlight capitalised terms? bertietheblue Word 2 02-08-2013 04:44 PM
Wild Card Problem (Word 2007) Problem saving in Word 2007 a dotm Addin developed in Word 2010 RichardP Word VBA 6 04-26-2012 04:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:18 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