Using a bit of code to browse and open Outlook folders from a form in Access (2007).
Code works fine. If I press the Cancel button in the "browse for Outlook folder" window, get a runtime 91 error.
See code below:
Private Sub Command187_Click()
Dim mOutlookApp As Outlook.Application
Dim mNameSpace As Outlook.NameSpace
Set mOutlookApp = New Outlook.Application
Set mNameSpace = mOutlookApp.GetNamespace("MAPI")
mNameSpace.PickFolder.Display
Set mNameSpace = Nothing
Set mOutlookApp = Nothing
End Sub
Would like to be able to cancel out of the Outlook window opened from Access and forego the standard windows error message.
Code works fine. If I press the Cancel button in the "browse for Outlook folder" window, get a runtime 91 error.
See code below:
Private Sub Command187_Click()
Dim mOutlookApp As Outlook.Application
Dim mNameSpace As Outlook.NameSpace
Set mOutlookApp = New Outlook.Application
Set mNameSpace = mOutlookApp.GetNamespace("MAPI")
mNameSpace.PickFolder.Display
Set mNameSpace = Nothing
Set mOutlookApp = Nothing
End Sub
Would like to be able to cancel out of the Outlook window opened from Access and forego the standard windows error message.