Use the Move method and obtain a reference to the destination folder by
using the OpenMAPIFolder procedure shown below.
objDestinationFolder = OpenMAPIFolder("\Public Folders\All Public
Folders\Foobar")
MyItem.Move objDestinationFolder
'***************************************************************************
***
'Custom procedure: OpenMAPIFolder(ByVal strPath As String)
'Purpose: Return a MAPIFolder from Path argument
'Returns: MAPIFolder object
'***************************************************************************
***
Function OpenMAPIFolder(ByVal strPath As String) As MAPIFolder
Dim oFolder As MAPIFolder
Dim strDir As String
Dim strName As String
Dim i As Integer
On Error Resume Next
If Left(strPath, Len("\")) = "\" Then
strPath = Mid(strPath, Len("\") + 1)
Else
oFolder = m_olApp.ActiveExplorer.CurrentFolder
End If
While strPath <> ""
i = InStr(strPath, "\")
If CBool(i) Then
strDir = Left(strPath, i - 1)
strPath = Mid(strPath, i + Len("\"))
Else
strDir = strPath
strPath = ""
End If
If oFolder Is Nothing Then
oFolder = m_olApp.GetNamespace("MAPI").Folders.Item(strDir)
On Error GoTo 0
Else
oFolder = oFolder.Folders.Item(strDir)
End If
End While
OpenMAPIFolder = oFolder
End Function
--
Randy Byrne, MVP - Outlook
http://www.microeye.com
Building Applications with Microsoft Outlook 2002 (MSPress - July 2001)
Building Applications with Microsoft Outlook 2000 (MSPress)
http://www.microeye.com/books
Micro Eye ZipOut
http://www.microeye.com/zipout