Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
How do I delete p1 through p669 using wildscards?
|
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Sorry, but despite the distinct impression it gives to the contrary Word has
no idea what a "page" is - it deals strictly with range of content from beginning to end. Therefore there is no provision for selecting by page. One way to remove the unwanted content: Click at the beginning of what you want to delete, scroll to see the end of that content (using the vertical scroll bar - drag the scroll bar button), then Shift+Click at that spot & press Delete. HTH |:) Bob Jones [MVP] Office:Mac On 12/26/07 5:34 PM, in article , "Ronnie" wrote: How do I delete p1 through p669 using wildscards? |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Hi Ronnie,
what are you talking about? Pages? Or Text, like "p1" "p100" "p800" "p6691" (watch out !) "pp11-13" (watch out !) For text there are many programmatic solutions, I don't think, wildcards will help much here. For pages: make sure extend-mode is off, goto the start of the doc, make sure extend-mode is on, goto page 670, (edit goto page), hit delete. -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Vista Small Business, Office XP |
#4
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
You've gotten two other responses that assume you're talking about deleting
pages, rather than numbers. If you mean that you want to delete all instances of text matching "p1" through "p669", if you set Find what: to p[0-9]{1,3} (with Use wildcards enabled), it will match p1 through p999. If you find/replace that while leaving Replace with: blank, all occurrences of p(1 to 3 numbers) will be deleted. Note that this would also change "p1234" into "4". If you also want to leave all occurrences of p followed by 4 or more numbers alone, then you would use: p[0-9]{1,3}[!0-9] If you want it to leave everything above p669 alone (i.e., p670 through p[infinity]), it gets a little more complicated. -- Herb Tyson MS MVP Author of the Word 2007 Bible Blog: http://word2007bible.herbtyson.com Web: http://www.herbtyson.com "Ronnie" wrote in message ... How do I delete p1 through p669 using wildscards? |
#5
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Hi Herb,
p[0-9]{1,3}[!0-9] that was the trap I fell into as well. It finds "p123A". :-( I thought about something like that: Sub Test669() Dim rDcm As Range For x = 1 To 669 ' brute force Set rDcm = ActiveDocument.Range With rDcm.Find .Text = "p" & CStr(x) While .Execute If Not rDcm.Characters.Last.Next Like "#" Then rDcm.HighlightColorIndex = wdBrightGreen End If Wend End With Next End Sub Then delete the such highlighted text. Which rises the question, is there an otherwise not used highlighting in the doc? Black, I think, might be a 999999:1 chance. I've never heard of someone, highlighting text in black. :-) -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Vista Small Business, Office XP |
#6
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Another possibility would be to create another [] set that includes all of
the acceptable characters that might follow a p### you want to match. Presumably, these would be things like a space, period, comma, colon, semicolon, etc. So, p[0-9]{1,3}[ .,;:etc.] might do the trick... assuming that the OP was using p669 as an example rather than an explicit upper limit (and values above 669 are also something you want to zap), -- Herb Tyson MS MVP Author of the Word 2007 Bible Blog: http://word2007bible.herbtyson.com Web: http://www.herbtyson.com "Helmut Weber" wrote in message ... Hi Herb, p[0-9]{1,3}[!0-9] that was the trap I fell into as well. It finds "p123A". :-( I thought about something like that: Sub Test669() Dim rDcm As Range For x = 1 To 669 ' brute force Set rDcm = ActiveDocument.Range With rDcm.Find .Text = "p" & CStr(x) While .Execute If Not rDcm.Characters.Last.Next Like "#" Then rDcm.HighlightColorIndex = wdBrightGreen End If Wend End With Next End Sub Then delete the such highlighted text. Which rises the question, is there an otherwise not used highlighting in the doc? Black, I think, might be a 999999:1 chance. I've never heard of someone, highlighting text in black. :-) -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Vista Small Business, Office XP |
#7
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Thank you all! p[0-9]{1,3}[!0-9] will do what is needed. I should have been
more specific in my question. I need to remove space"p1" to "p669" followed by a space which are embedded throughout my text. I didn't realize that "p" could indicate page. I appreciate all the answers as I learned something from each one. Ronnie "Herb Tyson [MVP]" wrote: Another possibility would be to create another [] set that includes all of the acceptable characters that might follow a p### you want to match. Presumably, these would be things like a space, period, comma, colon, semicolon, etc. So, p[0-9]{1,3}[ .,;:etc.] might do the trick... assuming that the OP was using p669 as an example rather than an explicit upper limit (and values above 669 are also something you want to zap), -- Herb Tyson MS MVP Author of the Word 2007 Bible Blog: http://word2007bible.herbtyson.com Web: http://www.herbtyson.com "Helmut Weber" wrote in message ... Hi Herb, p[0-9]{1,3}[!0-9] that was the trap I fell into as well. It finds "p123A". :-( I thought about something like that: Sub Test669() Dim rDcm As Range For x = 1 To 669 ' brute force Set rDcm = ActiveDocument.Range With rDcm.Find .Text = "p" & CStr(x) While .Execute If Not rDcm.Characters.Last.Next Like "#" Then rDcm.HighlightColorIndex = wdBrightGreen End If Wend End With Next End Sub Then delete the such highlighted text. Which rises the question, is there an otherwise not used highlighting in the doc? Black, I think, might be a 999999:1 chance. I've never heard of someone, highlighting text in black. :-) -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Vista Small Business, Office XP |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
wildcard(\nt\%( ,\nt\% )) | Microsoft Word Help | |||
Find & Replace Wildcard Expression for Ordinal Numbers | Microsoft Word Help | |||
A wildcard question | Microsoft Word Help | |||
Help with wildcard search, please? | New Users | |||
Using a Wildcard | Microsoft Word Help |