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

Move email via script - Outlook 2003



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 9th 09, 11:30 AM posted to microsoft.public.outlook.program_vba
Robert Haines
external usenet poster
 
Posts: 1
Default Move email via script - Outlook 2003

I have a script that will move the email from a specific person to an archive
folder.

The problem is that thg received date is reset to the date and time of when
the script is ran. Is this normal behaviour? if so is there a way around it?

Code is as follows.....

Function Quote(MyText)
Quote = Chr(34) & MyText & Chr(34)
End Function
'On Error Resume Next
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objInbox = objNamespace.GetDefaultFolder(olFolderInbox)
'Set objfolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
set objFolder = objFolder.Folders("z_archive")
'Set objFolder = objFolder.Folders("2008")
Set colItems = objInbox.Items
Set colItems = objInbox.Items
Set objItem = colItems.Find("[SenderName] = 'PersonA'")
'Set objItem = colItems.Find strSearch
Do While TypeName(objItem) "Nothing"
objItem.Move objFolder
Set objItem = colItems.FindNext
Loop


Eventually i'll be wanting to change the filer to a date but this code
doesnt pick up anything

strSearch = "[Start] = " & _
Quote("January 1, 2008 00:00") & _
" AND [End] " & _
Quote("December 31, 2008 23:59")
Set objItem = colItems.Find strSearch

Could someone advise what i'm missing please?

Thanks
Ads
 




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
Move email to directory folder, and then move email to another fol margarita25 Outlook and VBA 3 January 26th 09 03:35 PM
How can I get Outlook 2003 (IMAP) to automatically move Junk-email to the junk folder ? [email protected] Outlook - General Queries 1 July 4th 07 05:38 PM
Can't move an email message that's already been moved: OL 2003 [email protected] Outlook - General Queries 2 December 31st 06 11:53 PM
move outlook exp mailbox 2 2003 w/o merging it w/business email 2houndmom Outlook - Installation 3 December 9th 06 03:55 AM
how to recover email if missing message when using rule to move from exchange server to 2003 pst Patrick Outlook - General Queries 1 August 31st 06 06:07 AM


All times are GMT +1. The time now is 04:51 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.