A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Find Method wild card search?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 2nd 06, 08:22 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 1
Default Find Method wild card search?

Hello,

I am trying to figure out the following.

Is it possible to do a dynamic search on a subject line?

This is the subject line:

Dictation Job 09121-006, John Doe (TMALA), Acct 3235555555,filename:
GR169-477

Can I do something like:

myItems.Find("[Subject] = 'Dictation Job *, * *, Acct *,filename: * ")

We are using Outlook 2000

I'm very new to VBA.

any help will be appreciated.

Thanks.

Ads
  #2  
Old May 2nd 06, 09:06 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Find Method wild card search?

Yes, you can use the LIKE predicate, but only with the AdvancedSearch object,
not the Restrict method.

Here's a sample from the Outook VBA Reference:

Public blnSearchComp As Boolean

Private Sub Application_AdvancedSearchComplete(ByVal SearchObject As Search)
MsgBox "The AdvancedSearchComplete Event fired"
blnSearchComp = True
End Sub

Sub TestAdvancedSearchComplete()
Dim sch As Outlook.Search
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF As String = "urn:schemas:httpmail:subject LIKE '%mykeyword%'"
Const strS As String = "Inbox"
Set sch = Application.AdvancedSearch(strS, strF)
While blnSearchComp = False
DoEvents
Wend
Set rsts = sch.Results
For i = 1 To rsts.Count
MsgBox rsts.Item(i).SenderName
Next
End Sub


--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

Hello,

I am trying to figure out the following.

Is it possible to do a dynamic search on a subject line?

This is the subject line:

Dictation Job 09121-006, John Doe (TMALA), Acct 3235555555,filename:
GR169-477

Can I do something like:

myItems.Find("[Subject] = 'Dictation Job *, * *, Acct *,filename: * ")

We are using Outlook 2000

I'm very new to VBA.

any help will be appreciated.

Thanks.


  #3  
Old May 2nd 06, 10:29 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Find Method wild card search?

Eric, the syntax can be used with Restrict, a neat little undocumented plus:

strRestrict = "@SQL=" ' then add the filter to that. no spaces.
oItems.Restrict(strRestrict)

So LIKE can be used in a Restrict clause

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Eric Legault [MVP - Outlook]" wrote in
message ...
Yes, you can use the LIKE predicate, but only with the AdvancedSearch
object,
not the Restrict method.

Here's a sample from the Outook VBA Reference:

Public blnSearchComp As Boolean

Private Sub Application_AdvancedSearchComplete(ByVal SearchObject As
Search)
MsgBox "The AdvancedSearchComplete Event fired"
blnSearchComp = True
End Sub

Sub TestAdvancedSearchComplete()
Dim sch As Outlook.Search
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF As String = "urn:schemas:httpmail:subject LIKE '%mykeyword%'"
Const strS As String = "Inbox"
Set sch = Application.AdvancedSearch(strS, strF)
While blnSearchComp = False
DoEvents
Wend
Set rsts = sch.Results
For i = 1 To rsts.Count
MsgBox rsts.Item(i).SenderName
Next
End Sub


--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


  #4  
Old May 2nd 06, 10:35 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Find Method wild card search?

But that's still only in OL2002 or later, right?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Ken Slovak - [MVP - Outlook]" wrote in message ...
Eric, the syntax can be used with Restrict, a neat little undocumented plus:

strRestrict = "@SQL=" ' then add the filter to that. no spaces.
oItems.Restrict(strRestrict)

So LIKE can be used in a Restrict clause

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Eric Legault [MVP - Outlook]" wrote in
message ...
Yes, you can use the LIKE predicate, but only with the AdvancedSearch
object,
not the Restrict method.

Here's a sample from the Outook VBA Reference:

Public blnSearchComp As Boolean

Private Sub Application_AdvancedSearchComplete(ByVal SearchObject As
Search)
MsgBox "The AdvancedSearchComplete Event fired"
blnSearchComp = True
End Sub

Sub TestAdvancedSearchComplete()
Dim sch As Outlook.Search
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF As String = "urn:schemas:httpmail:subject LIKE '%mykeyword%'"
Const strS As String = "Inbox"
Set sch = Application.AdvancedSearch(strS, strF)
While blnSearchComp = False
DoEvents
Wend
Set rsts = sch.Results
For i = 1 To rsts.Count
MsgBox rsts.Item(i).SenderName
Next
End Sub


--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


  #5  
Old May 3rd 06, 05:43 AM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Find Method wild card search?

Ooh, that's a juicy little tidbit! Thanks Ken.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Ken Slovak - [MVP - Outlook]" wrote:

Eric, the syntax can be used with Restrict, a neat little undocumented plus:

strRestrict = "@SQL=" ' then add the filter to that. no spaces.
oItems.Restrict(strRestrict)

So LIKE can be used in a Restrict clause

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Eric Legault [MVP - Outlook]" wrote in
message ...
Yes, you can use the LIKE predicate, but only with the AdvancedSearch
object,
not the Restrict method.

Here's a sample from the Outook VBA Reference:

Public blnSearchComp As Boolean

Private Sub Application_AdvancedSearchComplete(ByVal SearchObject As
Search)
MsgBox "The AdvancedSearchComplete Event fired"
blnSearchComp = True
End Sub

Sub TestAdvancedSearchComplete()
Dim sch As Outlook.Search
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF As String = "urn:schemas:httpmail:subject LIKE '%mykeyword%'"
Const strS As String = "Inbox"
Set sch = Application.AdvancedSearch(strS, strF)
While blnSearchComp = False
DoEvents
Wend
Set rsts = sch.Results
For i = 1 To rsts.Count
MsgBox rsts.Item(i).SenderName
Next
End Sub


--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/



  #6  
Old May 3rd 06, 02:26 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Find Method wild card search?

I believe so but I've never tested it with an Outlook 2000 setup.

But it's an interesting undocumented way to get wildcards and other things
you can't really do with the Jet syntax without waiting for Outlook 2007 if
you don't have to support Outlook 2000.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Sue Mosher [MVP-Outlook]" wrote in message
...
But that's still only in OL2002 or later, right?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
search function does not find BCC recipients Jack Outlook Express 5 April 6th 06 04:10 PM
Search/Find with multiple calendars open? emilidcam Outlook - Calandaring 2 April 3rd 06 07:12 PM
Search for e-mail from a contact from an address card. John Outlook - Using Contacts 2 April 2nd 06 01:33 AM
Why can't I find a contact through search? lostquilt Outlook - Using Contacts 4 January 31st 06 10:53 PM
Find a Contact Search Box Dana Scully Outlook - Using Contacts 0 January 25th 06 11:17 PM


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.