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 - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

outlook 2007 - search all folders for mail with subject



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 10th 08, 04:22 PM posted to microsoft.public.outlook.program_forms
soler
external usenet poster
 
Posts: 1
Default outlook 2007 - search all folders for mail with subject

Need to create a script for outlook 2007 where I can search all folders for
e-mail to a group or mail alias.

Any help greatly appreciated.

--
soler
Ads
  #2  
Old November 18th 08, 01:34 PM posted to microsoft.public.outlook.program_forms
Alan Moseley
external usenet poster
 
Posts: 61
Default outlook 2007 - search all folders for mail with subject

I wrote the VBA code below as an answer to another post. You could easy
adapt it for your own purposes:-

Public Sub ScanAllFolders()
Dim objFolder As MAPIFolder
Dim lngItems As Long
Dim lngCounter As Long
Set objFolder =
Outlook.GetNamespace("MAPI").GetDefaultFolder(olFo lderInbox).Parent
Call ScanFolder(objFolder)
Set objFolder = Nothing
End Sub
Private Sub ScanFolder(objMAPIFolder As MAPIFolder)
Dim lngItems As Long
Dim lngCounter As Long
Dim objMailItem As MailItem
Dim objFolder As MAPIFolder
For Each objFolder In objMAPIFolder.Folders
Call ScanFolder(objFolder)
Next
For lngCounter = 1 To objMAPIFolder.Items.Count
If TypeName(objMAPIFolder.Items(lngCounter)) = "MailItem" Then
Set objMailItem = objMAPIFolder.Items(lngCounter)
If ")0 Then
Debug.Print objMailItem.SentOn, objMailItem.Subject
End If
Set objMailItem = Nothing
End If
Next
End Sub

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"soler" wrote:

Need to create a script for outlook 2007 where I can search all folders for
e-mail to a group or mail alias.

Any help greatly appreciated.

--
soler

 




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 through all users calenders with subject text as search criteria Mads Westen Outlook and VBA 3 August 7th 08 03:39 PM
Search folders -- subject containing XXX *OR* Category contains "XXX" [email protected] Outlook - General Queries 0 November 21st 07 04:16 PM
Search folders gone in Outlook 2007 [email protected] Outlook - General Queries 2 January 25th 07 01:05 AM
Outlook 2003 - Search folders - adding criteria to an old mail search? Dustin Emhart Outlook - General Queries 0 December 20th 06 03:39 PM
creating new mail subject folder in outlook express local folders heading themntneer Outlook Express 4 October 8th 06 02:41 AM


All times are GMT +1. The time now is 06:12 PM.


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