Macro to search for word

D

Dave Neve

Hello

I do not really know much about VBA and macros and Outlook does not even
have a macro recorder.

So I recorded the following macro in Word and inserted it into Outlook but
it doesn't work of course.

Could sm kindly indicate the problem or better still correct it?

The macro should search for the word "Sergic" in messages.

Thanks in advance

PS I'm pretty sure I can install it once it is written.
 
S

Sue Mosher [MVP-Outlook]

That's not possible, since you neither posted any code nor stated exactly what your goal is.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
D

Dave Neve

Oops a daisy

Here is the code (that doesn't work) to find the word 'Sergic' in messages.

Sorry about that.

Can anyone now help correct it please?

Thanks

Sub SearchSergic()

' Macro enregistrée le 25/07/2006 par Dave Neve

Selection.Find.ClearFormatting
With Selection.Find
.Text = "Sergic"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub


"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de %[email protected]...
That's not possible, since you neither posted any code nor stated exactly
what your goal is.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

"find ... in messages" or "find in the currently open message" There's a world of difference. Please provide a complete description of what you're really trying to accomplish, in what version of Outlook, and with Word or Outlook as your default email editor.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Dave Neve said:
Oops a daisy

Here is the code (that doesn't work) to find the word 'Sergic' in messages.

Sorry about that.

Can anyone now help correct it please?

Thanks

Sub SearchSergic()

' Macro enregistrée le 25/07/2006 par Dave Neve

Selection.Find.ClearFormatting
With Selection.Find
.Text = "Sergic"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub


"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de %[email protected]...
That's not possible, since you neither posted any code nor stated exactly
what your goal is.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Dave Neve said:
Hello

I do not really know much about VBA and macros and Outlook does not even
have a macro recorder.

So I recorded the following macro in Word and inserted it into Outlook but
it doesn't work of course.

Could sm kindly indicate the problem or better still correct it?

The macro should search for the word "Sergic" in messages.

Thanks in advance

PS I'm pretty sure I can install it once it is written.
 
D

Dave Neve

Hi

Well, normally it is "find in the currently open message" (as I use Copernic
desktop search for major searches thru multiple messages/folders

I have Office 2003 and I use Outlook as my default mail editor so the macro
has to work in Outlook.

I simply want to find the word 'Sergic' in certain messages that I open.

Hope this is all you need this time.

Thanks

Dave Neve

"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
"find ... in messages" or "find in the currently open message" There's a
world of difference. Please provide a complete description of what you're
really trying to accomplish, in what version of Outlook, and with Word or
Outlook as your default email editor.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Dave Neve said:
Oops a daisy

Here is the code (that doesn't work) to find the word 'Sergic' in
messages.

Sorry about that.

Can anyone now help correct it please?

Thanks

Sub SearchSergic()

' Macro enregistrée le 25/07/2006 par Dave Neve

Selection.Find.ClearFormatting
With Selection.Find
.Text = "Sergic"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub


"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le
message
de %[email protected]...
That's not possible, since you neither posted any code nor stated exactly
what your goal is.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Dave Neve said:
Hello

I do not really know much about VBA and macros and Outlook does not even
have a macro recorder.

So I recorded the following macro in Word and inserted it into Outlook
but
it doesn't work of course.

Could sm kindly indicate the problem or better still correct it?

The macro should search for the word "Sergic" in messages.

Thanks in advance

PS I'm pretty sure I can install it once it is written.
 
S

Sue Mosher [MVP-Outlook]

So, what functionality are you looking for that the Edit | Find command doesn't give you?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
D

Dave Neve

None.

I simply want to execute the macro with a single click and without needing
to type in the search word every time.

Regards

Dave Neve
"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
So, what functionality are you looking for that the Edit | Find command
doesn't give you?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

There's nothing simple about that at all. In fact, it can't be done in VBA without either a SendKeys kludge or a third-party programming library, Redemption (http://www.dimastr.com/redemption/), which exposes the necessary methods and properties in its SafeInspector object. Even with Redemption, I think you'll need to write code for three different editors, for the three different mail formats.

Maybe a quick-and-dirty alternative in your case is to use a combination of CommandBars techniques (see http://www.outlookcode.com/d/tips/commandbarfun.htm) and SendKeys to automate the Find command directly.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Dave Neve said:
None.

I simply want to execute the macro with a single click and without needing
to type in the search word every time.

Regards

Dave Neve
"Sue Mosher [MVP-Outlook]" <[email protected]> a écrit dans le message
de news: (e-mail address removed)...
So, what functionality are you looking for that the Edit | Find command
doesn't give you?
 

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