I would suggest you check that out on an Outlook forum, however, here are a couple procedures you can use to determine how to instantiate a folder.
'******************************************************************************
'Custom procedure: GetFolderPath(ByVal objFolder)
'Purpose: Return a string folder path for a MAPIFolder
'Argument: MAPIFolder object
'Usage: MsgBox "The Folder Path is " & GetFolderPath(objFldr)
'Returns: String representing Folder Path
'******************************************************************************
Function GetFolderPath(ByVal objFolder) As String
On Error Resume Next
Dim strFolderPath As String
Dim objChild As MAPIFolder
Dim objParent As MAPIFolder
strFolderPath = "\" & objFolder.Name
Set objChild = objFolder
Do Until Err <> 0
Set objParent = objChild.Parent
If Err <> 0 Then
Exit Do
End If
strFolderPath = "\" & objParent.Name & strFolderPath
Set objChild = objParent
Loop
GetFolderPath = strFolderPath
End Function
'******************************************************************************
'Custom procedure: OpenMAPIFolder(ByVal strPath)
'Purpose: Return a MAPIFolder from Path argument
'Argument: String representation of folder path
'Usage:
'Set objFldr=OpenMAPIFolder("\Public Folders\All Public Folders"
'Returns: MAPIFolder object
'******************************************************************************
Function OpenMAPIFolder(ByVal strPath) As MAPIFolder
Dim objFldr 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
Set objFldr = golApp.ActiveExplorer.CurrentFolder
End If
While strPath <> ""
i = InStr(strPath, "\"
If i Then
strDir = Left(strPath, i - 1)
strPath = Mid(strPath, i + Len("\")
Else
strDir = strPath
strPath = ""
End If
If objFldr Is Nothing Then
Set objFldr = golApp.GetNamespace("MAPI".Folders(strDir)
On Error GoTo 0
Else
Set objFldr = objFldr.Folders(strDir)
End If
Wend
Set OpenMAPIFolder = objFldr
End Function
-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.