Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win98 closes Outlook when using Event_BeforeFolderSwitch

Status
Not open for further replies.

merlinx

Programmer
Sep 20, 2002
170
DE
Everything works fine in the BeforeFolderSwitch code except when Cancel = True, Windows then produces a critical error message and shuts down Outlook.

I've tried this using VBA directly in Outlook and also building it into an Add-In for Outlook. In both cases the code produces the same problem.

I changed the code several times to see if the sub is entered and if the new folder object contains anything. I then included a message box to question if the folder should be changed yes/no to set it at will, and error handling. The code runs as wished with out errors all the way up to End Sub, After which Windows then brings up a critical error message reffering to a page fault in outllib.dll.

Enviroment : Win98/Outlook2000/VB6 Pro
Code is example code from Microsoft


Dim myOlApp As Outlook.Application

Public WithEvents myOlExp As Outlook.Explorer

Public Sub Initialize_handler()
Set myOlExp = myOlApp.ActiveExplorer
End Sub

Private Sub myOlExp_BeforeFolderSwitch(ByVal NewFolder As Object, Cancel As Boolean)
If NewFolder.Name = "Off Limits" Then
MsgBox "You do not have permission to access this folder."
Cancel = True
End If
End Sub
 
Found out that if security is set to it's lowest then it works fine. Does anyone know how I can use this at a different security level? I've tried this with :
outlook vba,
as an add-in dll,
external app as exe,
digital certificates,
everything I could find at MS knowledege base,
Service packs Win98/Office2000/Visual Studio,
new installations
and everthing else I could think of.

At the same time when the event (BeforeFolderSwitch : Cancel = True) doesn't work (BeforeViewSwitch : Cancel = True) does work.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top