Macro help

G

Guest

I absolutely love learning how to use wildcard searches, and here's what I'm
trying to do:

There are times when I like to skip through certain parts of a document
sentence by sentence. So far the following search has yielded great results
for sentences ending in a period followed by one or two spaces or a paragraph
mark:

.[ {1,2}^13]

However, nothing I try to do with sentences ending in a question mark or
exclamation point seems to work. I tried putting a backslash before them but
that didn't work either. What am I doing wrong?

Thanks soooooo much for being there. You wonderful people have taught me
practically all I know!
 
J

Jay Freedman

Try again, using the expressions

\?[ {1,2}^13]
\![ {1,2}^13]

or, for everything together,

[.\?\!][ {1,2}^13]

They work for me.

I absolutely love learning how to use wildcard searches, and here's what I'm
trying to do:

There are times when I like to skip through certain parts of a document
sentence by sentence. So far the following search has yielded great results
for sentences ending in a period followed by one or two spaces or a paragraph
mark:

.[ {1,2}^13]

However, nothing I try to do with sentences ending in a question mark or
exclamation point seems to work. I tried putting a backslash before them but
that didn't work either. What am I doing wrong?

Thanks soooooo much for being there. You wonderful people have taught me
practically all I know!
 
J

Jay Freedman

Noticing that the subject line mentions "macro", here's a macro that
goes to the next occurrence:

Sub NextSent()
Dim oRg As Range
Set oRg = ActiveDocument.Range _
(Start:=Selection.Range.End, _
End:=ActiveDocument.Range.End)
With oRg.Find
.ClearFormatting
.Text = "[.\?\!][ {1,2}^13]"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
If .Execute Then
oRg.Select
End If
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Try again, using the expressions

\?[ {1,2}^13]
\![ {1,2}^13]

or, for everything together,

[.\?\!][ {1,2}^13]

They work for me.

I absolutely love learning how to use wildcard searches, and here's what I'm
trying to do:

There are times when I like to skip through certain parts of a document
sentence by sentence. So far the following search has yielded great results
for sentences ending in a period followed by one or two spaces or a paragraph
mark:

.[ {1,2}^13]

However, nothing I try to do with sentences ending in a question mark or
exclamation point seems to work. I tried putting a backslash before them but
that didn't work either. What am I doing wrong?

Thanks soooooo much for being there. You wonderful people have taught me
practically all I know!
 
G

Guest

Thank you, thank you, thank you, Jay! As usual, you just made my life easier
and my work much more exciting! (I know, I know! Most people would laugh if
I told them that anything about word processing was exciting!)

Jay Freedman said:
Noticing that the subject line mentions "macro", here's a macro that
goes to the next occurrence:

Sub NextSent()
Dim oRg As Range
Set oRg = ActiveDocument.Range _
(Start:=Selection.Range.End, _
End:=ActiveDocument.Range.End)
With oRg.Find
.ClearFormatting
.Text = "[.\?\!][ {1,2}^13]"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
If .Execute Then
oRg.Select
End If
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Try again, using the expressions

\?[ {1,2}^13]
\![ {1,2}^13]

or, for everything together,

[.\?\!][ {1,2}^13]

They work for me.

I absolutely love learning how to use wildcard searches, and here's what I'm
trying to do:

There are times when I like to skip through certain parts of a document
sentence by sentence. So far the following search has yielded great results
for sentences ending in a period followed by one or two spaces or a paragraph
mark:

.[ {1,2}^13]

However, nothing I try to do with sentences ending in a question mark or
exclamation point seems to work. I tried putting a backslash before them but
that didn't work either. What am I doing wrong?

Thanks soooooo much for being there. You wonderful people have taught me
practically all I know!
 
A

aalaan

Is it though! And people like Jay make it even better...

Island Girl said:
Thank you, thank you, thank you, Jay! As usual, you just made my life
easier
and my work much more exciting! (I know, I know! Most people would laugh
if
I told them that anything about word processing was exciting!)

Jay Freedman said:
Noticing that the subject line mentions "macro", here's a macro that
goes to the next occurrence:

Sub NextSent()
Dim oRg As Range
Set oRg = ActiveDocument.Range _
(Start:=Selection.Range.End, _
End:=ActiveDocument.Range.End)
With oRg.Find
.ClearFormatting
.Text = "[.\?\!][ {1,2}^13]"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
If .Execute Then
oRg.Select
End If
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Try again, using the expressions

\?[ {1,2}^13]
\![ {1,2}^13]

or, for everything together,

[.\?\!][ {1,2}^13]

They work for me.

On Sat, 28 Oct 2006 09:38:01 -0700, Island Girl

I absolutely love learning how to use wildcard searches, and here's
what I'm
trying to do:

There are times when I like to skip through certain parts of a document
sentence by sentence. So far the following search has yielded great
results
for sentences ending in a period followed by one or two spaces or a
paragraph
mark:

.[ {1,2}^13]

However, nothing I try to do with sentences ending in a question mark
or
exclamation point seems to work. I tried putting a backslash before
them but
that didn't work either. What am I doing wrong?

Thanks soooooo much for being there. You wonderful people have taught
me
practically all I know!
 
G

Guest

Couldn't have said it better, Aalaan.

aalaan said:
Is it though! And people like Jay make it even better...

Island Girl said:
Thank you, thank you, thank you, Jay! As usual, you just made my life
easier
and my work much more exciting! (I know, I know! Most people would laugh
if
I told them that anything about word processing was exciting!)

Jay Freedman said:
Noticing that the subject line mentions "macro", here's a macro that
goes to the next occurrence:

Sub NextSent()
Dim oRg As Range
Set oRg = ActiveDocument.Range _
(Start:=Selection.Range.End, _
End:=ActiveDocument.Range.End)
With oRg.Find
.ClearFormatting
.Text = "[.\?\!][ {1,2}^13]"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
If .Execute Then
oRg.Select
End If
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 28 Oct 2006 13:20:55 -0400, Jay Freedman

Try again, using the expressions

\?[ {1,2}^13]
\![ {1,2}^13]

or, for everything together,

[.\?\!][ {1,2}^13]

They work for me.

On Sat, 28 Oct 2006 09:38:01 -0700, Island Girl

I absolutely love learning how to use wildcard searches, and here's
what I'm
trying to do:

There are times when I like to skip through certain parts of a document
sentence by sentence. So far the following search has yielded great
results
for sentences ending in a period followed by one or two spaces or a
paragraph
mark:

.[ {1,2}^13]

However, nothing I try to do with sentences ending in a question mark
or
exclamation point seems to work. I tried putting a backslash before
them but
that didn't work either. What am I doing wrong?

Thanks soooooo much for being there. You wonderful people have taught
me
practically all I know!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top