View Single Post
  #1  
Old May 11th 06, 09:36 PM posted to microsoft.public.outlook.program_vba
Nader
external usenet poster
 
Posts: 29
Default Problem with : SaveSentMessageFolder

Hello,

I'm using outlook 2002 with Exchange server and I'm trying to change my code
using vba the default folder where the sent item are saved to a folder which
is on a public folder.

My code works great when the folder is on my mailbox but when the folder is
located on the network I get a message from outlook saying : "The Operation
failed".

Does anyone know why and how I can make it work ?

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

' Set the NameSpace object.
Set olns = Item.Application.GetNamespace("MAPI")

' MyFolder is a variant variable whose subtype is "object" since a Set
statement is used.
Set MyMailbox = olns.Folders("Public Folders")
Set MyFolder1 = MyMailbox.Folders("All Public Folders")
Set MyFolder2 = MyFolder1.Folders("Important")
Set MyFolder3 = MyFolder2.Folders("Document")

' Correctly sets the folder where the "sent item" will be stored.
Set Item.SaveSentMessageFolder = MyFolder


Item.SaveSentMessageFolder = MyFolder

End Sub


Ads