#1   Report Post  
Posted to microsoft.public.word.docmanagement
Ronnie Ronnie is offline
external usenet poster
 
Posts: 17
Default wildcard for numbers

How do I delete p1 through p669 using wildscards?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
CyberTaz CyberTaz is offline
external usenet poster
 
Posts: 1,348
Default wildcard for numbers

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   Report Post  
Posted to microsoft.public.word.docmanagement
Helmut Weber[_2_] Helmut Weber[_2_] is offline
external usenet poster
 
Posts: 45
Default wildcard for numbers

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   Report Post  
Posted to microsoft.public.word.docmanagement
Herb Tyson [MVP] Herb Tyson [MVP] is offline
external usenet poster
 
Posts: 2,936
Default wildcard for numbers

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   Report Post  
Posted to microsoft.public.word.docmanagement
Helmut Weber[_2_] Helmut Weber[_2_] is offline
external usenet poster
 
Posts: 45
Default wildcard for numbers

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   Report Post  
Posted to microsoft.public.word.docmanagement
Herb Tyson [MVP] Herb Tyson [MVP] is offline
external usenet poster
 
Posts: 2,936
Default wildcard for numbers

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   Report Post  
Posted to microsoft.public.word.docmanagement
Ronnie Ronnie is offline
external usenet poster
 
Posts: 17
Default wildcard for numbers

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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
wildcard(\nt\%( ,\nt\% )) Narendra Boga Microsoft Word Help 2 October 12th 07 01:36 PM
Find & Replace Wildcard Expression for Ordinal Numbers binar Microsoft Word Help 1 July 27th 07 04:41 PM
A wildcard question jezzica85 Microsoft Word Help 2 October 24th 06 07:12 AM
Help with wildcard search, please? Ed New Users 8 July 28th 06 11:18 AM
Using a Wildcard Steved Microsoft Word Help 4 May 30th 05 08:33 PM


All times are GMT +1. The time now is 11:51 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"