![]() |
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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi everyone
I've got a folder full of website e-mail forms, so all the messages are of the same format. We're using Outlook 2003 in an Exchange environment. I need to search through and find a particular set of messages that have the following string: double-sized listing? Yes Searching for just the string "double-sized listing?" won't work as all the forms have that text. The problem is I can't find a way to search for the line-break character. In MS Word you can search for special characters... I would accomplish the above search with the following... double-sized listing?^NYes But in Outlook that doesn't appear to work. Is there a way to search for this in Outlook? I assume there is a way, but I guess it might only be possible with VBA? Next time I think we are going to have to re-design our e-mail form to give the question and answer all on the one line. Thanks Ben |
Ads |
#2
|
|||
|
|||
![]()
Yes, you'll need code to do that. If you're searching the Body property, look for vbCrLf.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Ben Bradley" wrote in message ... Hi everyone I've got a folder full of website e-mail forms, so all the messages are of the same format. We're using Outlook 2003 in an Exchange environment. I need to search through and find a particular set of messages that have the following string: double-sized listing? Yes Searching for just the string "double-sized listing?" won't work as all the forms have that text. The problem is I can't find a way to search for the line-break character. In MS Word you can search for special characters... I would accomplish the above search with the following... double-sized listing?^NYes But in Outlook that doesn't appear to work. Is there a way to search for this in Outlook? I assume there is a way, but I guess it might only be possible with VBA? Next time I think we are going to have to re-design our e-mail form to give the question and answer all on the one line. Thanks Ben |
#3
|
|||
|
|||
![]()
Hi
Is there a complete example of the VBA script I need to complete this? I'm completely new to VBA but that would give me a great starting point to try some other searches of that nature. Also, I guess I need to load the Outlook VBa addin off the CD? We're using Outlook 2003. Thanks Ben Sue Mosher [MVP-Outlook] wrote: Yes, you'll need code to do that. If you're searching the Body property, look for vbCrLf. |
#4
|
|||
|
|||
![]()
VBA installs as part of the default setup. If you're completely new to it, start with the basics he http://outlookcode.com/article.aspx?id=49
Your macro (not script) would need to return the Inbox with GetDefaultFolder, then iterate over its Items collection, something like this: Sub DoSearch() Dim fld As Outlook.MAPIFolder Dim itm As Object Dim strFind As String On Error Resume Next Set fld = Application.Session.GetDefaultFolder(olFolderInbox ) strFind = "double-sized listing?" & vbCrLf & "Yes" ' or vbLf it's line feed not a complete CRLF For Each itm In fld.Items If InStr(1, Item.Body, strFind, vbTextCompare) 0 Then MsgBox "You found one!" End If Next Set itm = Nothing Set fld = Nothing End Sub -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Ben Bradley" wrote in message ... Hi Is there a complete example of the VBA script I need to complete this? I'm completely new to VBA but that would give me a great starting point to try some other searches of that nature. Also, I guess I need to load the Outlook VBa addin off the CD? We're using Outlook 2003. Thanks Ben Sue Mosher [MVP-Outlook] wrote: Yes, you'll need code to do that. If you're searching the Body property, look for vbCrLf. "Ben Bradley" wrote in message ... Hi everyone I've got a folder full of website e-mail forms, so all the messages are of the same format. We're using Outlook 2003 in an Exchange environment. I need to search through and find a particular set of messages that have the following string: double-sized listing? Yes Searching for just the string "double-sized listing?" won't work as all the forms have that text. The problem is I can't find a way to search for the line-break character. In MS Word you can search for special characters... I would accomplish the above search with the following... double-sized listing?^NYes But in Outlook that doesn't appear to work. Is there a way to search for this in Outlook? I assume there is a way, but I guess it might only be possible with VBA? Next time I think we are going to have to re-design our e-mail form to give the question and answer all on the one line. Thanks Ben |
#5
|
|||
|
|||
![]()
Hi Sue
Perfect. I got that code to work and the MsgBox repeatedly popped up on the screen. All the website form e-mails are in a particular sub-folder of my inbox. So that worked. Is there any way to generate an Outlook find results list of these messages? Thanks so much for your help so far! Ben Sue Mosher [MVP-Outlook] wrote: VBA installs as part of the default setup. If you're completely new to it, start with the basics he http://outlookcode.com/article.aspx?id=49 Your macro (not script) would need to return the Inbox with GetDefaultFolder, then iterate over its Items collection, something like this: Sub DoSearch() Dim fld As Outlook.MAPIFolder Dim itm As Object Dim strFind As String On Error Resume Next Set fld = Application.Session.GetDefaultFolder(olFolderInbox ) strFind = "double-sized listing?" & vbCrLf & "Yes" ' or vbLf it's line feed not a complete CRLF For Each itm In fld.Items If InStr(1, Item.Body, strFind, vbTextCompare) 0 Then MsgBox "You found one!" End If Next Set itm = Nothing Set fld = Nothing End Sub |
#6
|
|||
|
|||
![]()
Is there any way to generate an Outlook find results list of these messages?
You mean display them in the dialog for Advanced Find? Not programmatically. You'd need to provide your own display UI. Alternatively, use code to assign a category to those items that match your criteria, then search manually on that category. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Ben Bradley" wrote in message ... Hi Sue Perfect. I got that code to work and the MsgBox repeatedly popped up on the screen. All the website form e-mails are in a particular sub-folder of my inbox. So that worked. Is there any way to generate an Outlook find results list of these messages? Thanks so much for your help so far! Ben Sue Mosher [MVP-Outlook] wrote: VBA installs as part of the default setup. If you're completely new to it, start with the basics he http://outlookcode.com/article.aspx?id=49 Your macro (not script) would need to return the Inbox with GetDefaultFolder, then iterate over its Items collection, something like this: Sub DoSearch() Dim fld As Outlook.MAPIFolder Dim itm As Object Dim strFind As String On Error Resume Next Set fld = Application.Session.GetDefaultFolder(olFolderInbox ) strFind = "double-sized listing?" & vbCrLf & "Yes" ' or vbLf it's line feed not a complete CRLF For Each itm In fld.Items If InStr(1, Item.Body, strFind, vbTextCompare) 0 Then MsgBox "You found one!" End If Next Set itm = Nothing Set fld = Nothing End Sub |
#7
|
|||
|
|||
![]()
Ah ok.
That will still work I guess. So in the VBA code, how do I flag a message a certain colour? In this section of code: For Each itm In fld.Items If InStr(1, Item.Body, strFind, vbTextCompare) 0 Then MsgBox "You found one!" End If Next I need to change the... MsgBox "You found one!" line to set a flag colour for that message. What's the VBA for that? Also, is there a complete online reference of all VBA functions / commands? Thanks Ben Sue Mosher [MVP-Outlook] wrote: Is there any way to generate an Outlook find results list of these messages? You mean display them in the dialog for Advanced Find? Not programmatically. You'd need to provide your own display UI. Alternatively, use code to assign a category to those items that match your criteria, then search manually on that category. |
#8
|
|||
|
|||
![]()
Take a look at the MailItem.FlagIcon property. The complete reference is in object browser -- F2 in VBA -- as well as on MSDN.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Ben Bradley" wrote in message ... Ah ok. That will still work I guess. So in the VBA code, how do I flag a message a certain colour? In this section of code: For Each itm In fld.Items If InStr(1, Item.Body, strFind, vbTextCompare) 0 Then MsgBox "You found one!" End If Next I need to change the... MsgBox "You found one!" line to set a flag colour for that message. What's the VBA for that? Also, is there a complete online reference of all VBA functions / commands? Thanks Ben Sue Mosher [MVP-Outlook] wrote: Is there any way to generate an Outlook find results list of these messages? You mean display them in the dialog for Advanced Find? Not programmatically. You'd need to provide your own display UI. Alternatively, use code to assign a category to those items that match your criteria, then search manually on that category. |
#9
|
|||
|
|||
![]()
Hi Sue
Thanks for all your help so far. If all the e-mails are in a certain folder, how do I tell the script to process just a particular sub-folder. We're in an Exchange environment and the folder is located: Inbox\BB Website Forms This is what I've got so far: Sub DoSearch() Dim fld As Outlook.MAPIFolder Dim itm As Object Dim strFind As String On Error Resume Next Set fld = Application.Session.GetDefaultFolder(olFolderInbox ) strFind = "double-sized listing?" & vbCrLf & "Yes" ' or vbLf it's line feed not a complete CRLF For Each itm In fld.Items If InStr(1, Item.Body, strFind, vbTextCompare) 0 Then 'MsgBox "You found one!" itm.FlagIcon = olYellowFlagIcon itm.Save End If Next Set itm = Nothing Set fld = Nothing End Sub Thanks Ben Sue Mosher [MVP-Outlook] wrote: Take a look at the MailItem.FlagIcon property. The complete reference is in object browser -- F2 in VBA -- as well as on MSDN. |
#10
|
|||
|
|||
![]()
Every folder has a Folders collection that represents its subfolders. Each subfolder in a Folders collection must have a unique name. Hence, you can use fld.Folders("BB Website Forms").
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Ben Bradley" wrote in message ... Hi Sue Thanks for all your help so far. If all the e-mails are in a certain folder, how do I tell the script to process just a particular sub-folder. We're in an Exchange environment and the folder is located: Inbox\BB Website Forms This is what I've got so far: Sub DoSearch() Dim fld As Outlook.MAPIFolder Dim itm As Object Dim strFind As String On Error Resume Next Set fld = Application.Session.GetDefaultFolder(olFolderInbox ) strFind = "double-sized listing?" & vbCrLf & "Yes" ' or vbLf it's line feed not a complete CRLF For Each itm In fld.Items If InStr(1, Item.Body, strFind, vbTextCompare) 0 Then 'MsgBox "You found one!" itm.FlagIcon = olYellowFlagIcon itm.Save End If Next Set itm = Nothing Set fld = Nothing End Sub Thanks Ben Sue Mosher [MVP-Outlook] wrote: Take a look at the MailItem.FlagIcon property. The complete reference is in object browser -- F2 in VBA -- as well as on MSDN. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2007: How to break vertical line in reply to message? | [email protected] | Outlook - General Queries | 1 | October 5th 07 09:15 PM |
Outlook 2003... search for line break char | Ben Bradley | Outlook - General Queries | 0 | September 24th 07 04:29 PM |
Outlook 2003 - Search folders - adding criteria to an old mail search? | Dustin Emhart | Outlook - General Queries | 0 | December 20th 06 02:39 PM |
how do I break up a large attachment that I am sending in Outlook | roger | Outlook - Installation | 1 | April 19th 06 08:11 PM |
How to input line break in the body of an email defined in vb. | Xluser@work | Outlook and VBA | 1 | February 22nd 06 02:20 PM |