M
microsoft
I've got the following sub that is intended to open a new Explorer and
display the specified folder. It works on my home laptop but when I try to
use it on a machine connected to Exchange it craps out. The problem appears
to be at this line where the object is not being instantiated. Any Ideas?
[set objNamespace = objOutlook.GetNamespace("MAPI")]
sub displayFolder(sourceObject)
'Display the folder in a new Explorer window
set objOutlook = ObjectCenterTopOutlookViewControl.outlookApplication
set ovc = document.getElementById(sourceObject)
'From http://www.outlookcode.com/d/code/getfolder.htm
Dim aFolders
Dim fldr
Dim i
Dim objNS
set objNamespace = objOutlook.GetNamespace("MAPI")
'On Error Resume Next
strFolderPath = Replace(ovc.folder,"\\","")
strFolderPath = Replace(strFolderPath, "/", "\")
aFolders = Split(strFolderPath, "\")
'get the Outlook objects
'set the root folder
Set fldr = objNamespace.Folders(aFolders(0))
'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i =1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err <> 0 Then
msgbox(Err.number & " " & Err.Description)
Exit Sub
end if
Next
Set GetFolder = fldr
' de-reference objects
Set objNS = Nothing
GetFolder.display
set objExplorer = GetFolder.GetExplorer
'Hide preview pane
objExplorer.ShowPane 3, False
'Hide navigation pane
objExplorer.ShowPane 4, False
'Hide Todo pane
objExplorer.ShowPane 5, False
end sub
display the specified folder. It works on my home laptop but when I try to
use it on a machine connected to Exchange it craps out. The problem appears
to be at this line where the object is not being instantiated. Any Ideas?
[set objNamespace = objOutlook.GetNamespace("MAPI")]
sub displayFolder(sourceObject)
'Display the folder in a new Explorer window
set objOutlook = ObjectCenterTopOutlookViewControl.outlookApplication
set ovc = document.getElementById(sourceObject)
'From http://www.outlookcode.com/d/code/getfolder.htm
Dim aFolders
Dim fldr
Dim i
Dim objNS
set objNamespace = objOutlook.GetNamespace("MAPI")
'On Error Resume Next
strFolderPath = Replace(ovc.folder,"\\","")
strFolderPath = Replace(strFolderPath, "/", "\")
aFolders = Split(strFolderPath, "\")
'get the Outlook objects
'set the root folder
Set fldr = objNamespace.Folders(aFolders(0))
'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i =1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err <> 0 Then
msgbox(Err.number & " " & Err.Description)
Exit Sub
end if
Next
Set GetFolder = fldr
' de-reference objects
Set objNS = Nothing
GetFolder.display
set objExplorer = GetFolder.GetExplorer
'Hide preview pane
objExplorer.ShowPane 3, False
'Hide navigation pane
objExplorer.ShowPane 4, False
'Hide Todo pane
objExplorer.ShowPane 5, False
end sub