H
Howard Kaikow
'Below you will find a simplified vesion of code that produces an unhandled
exception error 100% of the time.
'
'Code requires a form with buttons named btnRunMe and btnEXit, and a label
named lblMBX (with WordWrap=true).
'
'And Eudora must not be running prior to execution of the code.
'
'I also tried using the appEudora_OnClose event, but that code was NEVER
entered. Implies that CloseEudora is not completing.
'
'Have I encountered a bug?
'Or, did I screw up?
' Author URL: http://www.standards.com/
' Author email address: (e-mail address removed)
' Date: 8 September 2007
' Using Eudora 7.1.0.9, the CloseEudora method, in the btnExit_Click event,
' results in an unhandled exception error.
Option Explicit
' Does not matter if WithEvents is not used.
Private WithEvents appEudora As EudoraLib.EuApplication
Private Sub btnRunMe_Click()
Const strEudoraServerName As String = "Eudora.EuApplication.1"
On Error Resume Next
' Eudora is not already running.
Set appEudora = CreateObject(strEudoraServerName)
Err.Clear
If Not (appEudora Is Nothing) Then
appEudora.Visible = False
End If
On Error GoTo 0
btnExit.SetFocus
lblMBX.Caption = "Thanks, now click on Exit button."
End Sub
Private Sub btnExit_Click()
If Not (appEudora Is Nothing) Then
appEudora.CloseEudora
Set appEudora = Nothing
End If
Unload Me
End Sub
Private Sub UserForm_Initialize()
'Private Sub Form_Load() lblMBX.Caption = "First, click on Run Me!
button." _
& vbCrLf & "Eudora should be briefly visible, then become
non-visible."
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
'Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'Prevent user from closing with the Close box in the title bar.
' If UnloadMode = vbFormControlMenu Then
If CloseMode = vbFormControlMenu Then
Cancel = 1
MsgBox "Please use the " & btnExit.Caption & " button to close the
Form", _
vbInformation + vbOKOnly, "Close button cannot be used to close
the Form"
End If
End Sub
exception error 100% of the time.
'
'Code requires a form with buttons named btnRunMe and btnEXit, and a label
named lblMBX (with WordWrap=true).
'
'And Eudora must not be running prior to execution of the code.
'
'I also tried using the appEudora_OnClose event, but that code was NEVER
entered. Implies that CloseEudora is not completing.
'
'Have I encountered a bug?
'Or, did I screw up?
' Author URL: http://www.standards.com/
' Author email address: (e-mail address removed)
' Date: 8 September 2007
' Using Eudora 7.1.0.9, the CloseEudora method, in the btnExit_Click event,
' results in an unhandled exception error.
Option Explicit
' Does not matter if WithEvents is not used.
Private WithEvents appEudora As EudoraLib.EuApplication
Private Sub btnRunMe_Click()
Const strEudoraServerName As String = "Eudora.EuApplication.1"
On Error Resume Next
' Eudora is not already running.
Set appEudora = CreateObject(strEudoraServerName)
Err.Clear
If Not (appEudora Is Nothing) Then
appEudora.Visible = False
End If
On Error GoTo 0
btnExit.SetFocus
lblMBX.Caption = "Thanks, now click on Exit button."
End Sub
Private Sub btnExit_Click()
If Not (appEudora Is Nothing) Then
appEudora.CloseEudora
Set appEudora = Nothing
End If
Unload Me
End Sub
Private Sub UserForm_Initialize()
'Private Sub Form_Load() lblMBX.Caption = "First, click on Run Me!
button." _
& vbCrLf & "Eudora should be briefly visible, then become
non-visible."
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
'Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'Prevent user from closing with the Close box in the title bar.
' If UnloadMode = vbFormControlMenu Then
If CloseMode = vbFormControlMenu Then
Cancel = 1
MsgBox "Please use the " & btnExit.Caption & " button to close the
Form", _
vbInformation + vbOKOnly, "Close button cannot be used to close
the Form"
End If
End Sub