View Single Post
  #3  
Old January 24th 08, 03:37 PM posted to microsoft.public.outlook.program_vba
thierry
external usenet poster
 
Posts: 3
Default Move to a folder my sending email

thank you Micheal,

You post was very helpfull, I had to add:

Set myCopiedItem = Item.Copy
myCopiedItem.Move
GetNamespace("MAPI").GetDefaultFolder(olFolderInbo x).Folders("offers
following")

it works pretty good, i am all set!

Bye

"Michael Bednarek" wrote:

On Thu, 24 Jan 2008 03:42:00 -0800, Thierry wrote in microsoft.public.outlook.program_vba:

I am a sales engineer and I send by email offers. I already coded my VBA for
Outlook in order to generate automatically a remainder 10 days after that I
send an offer.

Now, I would like to move this email with my offer attached to a folder
"offers following".

How Can i do this, right know I have the following in my code:

For Each PJ In Item.Attachments
If Left(PJ.FileName, 5) = "Offer" Then
MsgBox "OK"
Set myOlApp = CreateObject("Outlook.Application")
Set myApptItem = myOlApp.CreateItem(olAppointmentItem)
myApptItem.Start = Now + 10
myApptItem.End = Now + 10.015
myApptItem.Subject = Item.Subject
myApptItem.Save

Exit For


Have you tried:
Item.Move(GetNamespace("MAPI").GetDefaultFolder(ol FolderInbox).Folders("offers following"))

BTW, I'm not sure you need this code:
Set myOlApp = CreateObject("Outlook.Application")
Set myApptItem = myOlApp.CreateItem(olAppointmentItem)

IMO, this could be written (in an OLProject):
' Set myOlApp = CreateObject("Outlook.Application") ' not needed
Set myApptItem = CreateItem(olAppointmentItem)

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"

Ads