Originally Posted by
xld
Can you post the whole code, what you are doing seems okay, but the bigger picture would help.
So far, this is all the farther I've gotten...
This code is from the ThisOutlookSession module-
Public strSendAccount
Public Abort As Boolean
Sub Application_ItemSend _
(ByVal Item As Object, Cancel As Boolean)
Dim strMsg As String
Dim res As Long
Abort = False
frmChoose.Show
MsgBox Abort
If Abort = True Then
Cancel = True
Exit Sub
End If
If Item.Subject = "" Then
Cancel = True
strMsg = "Please fill in the subject before sending."
MsgBox strMsg, _
vbExclamation + vbSystemModal, "Missing Subject"
Item.Display
End If
End Sub
This is from the form module-
Sub btnCancel_Click()
Abort = True
MsgBox "in form module: " & Abort
Unload Me
End Sub
Private Sub btnSend_Click()
If Me.ListBox1 = "" Then
Abort = True
End If
strSendAccount = Me.ListBox1
Unload Me
End Sub
Private Sub UserForm_Activate()
Dim oAccount As Outlook.Account
For Each oAccount In Application.Session.Accounts
ListBox1.AddItem oAccount
Next
End Sub