Hello
I also wanted Outlook to prompt me for a mail account when seding emails,
however after reading many posts like yours without finding a solution, I
decided I should write my own solution. Which I have now done. You can see
what it looks like here:
http://www.daniel-mitchell.com/wp-content/uploads/2007/08/outlook2.gif
The code for it is as followed:
(Note there is also extra code here to stop me from sending emails without a
subject or without an attachement)
Public blnSend As Boolean
Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
If TypeOf item Is Outlook.mailItem Then
blnSend = False
Load frmAccountList ' Load account list form
frmAccountList.Show
If blnSend Then
' Check that the message has a subject - Compulsory!
If item.Subject = "" Then
MsgBox "You forgot the subject."
Cancel = True
Else
' Check that attachment has been added
If InStr(1, item.Body, "attach", vbTextCompare) > 0 Then
If item.Attachments.Count = 0 Then
ans = MsgBox("There's no attachment, send anyway?",
vbYesNo)
If ans = vbNo Then
Cancel = True
End If
End If
End If
End If
Else
Cancel = True
End If
End If
End Sub
I also created a form with 2 buttons and a list box. The code for that is as
followed:
Private Sub butCancel_Click()
frmAccountList.Hide
End Sub
Function changeAccount()
Dim item As mailItem
Set item = Application.ActiveInspector.CurrentItem
' Change Mail Account
item.SendUsingAccount =
Application.Session.Accounts(lstMailAccounts.Value)
' Enable Sending
ThisOutlookSession.blnSend = True
frmAccountList.Hide
End Function
Private Sub butSend_Click()
Call changeAccount
End Sub
Private Sub lstMailAccounts_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 13 Then
' On Enter Key Press
Call changeAccount
End If
End Sub
Private Sub UserForm_Initialize()
Dim item As mailItem
Set item = Application.ActiveInspector.CurrentItem
Dim oAccount As Outlook.Account
For Each oAccount In Application.Session.Accounts
If oAccount.AccountType = olPop3 Then
lstMailAccounts.AddItem (oAccount)
If oAccount = item.SendUsingAccount Then
lstMailAccounts.Value = oAccount
End If
End If
Next
End Sub
This now means whenever I send an email, I get a small box popup with a list
of all my mail accounts, I can use my arrow keys to select one, press Enter
or Send to change the outgoing mail account and send the message.
I wrote a blog post about it on my website:
http://www.daniel-mitchell.com/2007/08/03/outlook-2007-prompt-for-user-account-when-sending-email/
I appreciate that unless you have some coding experience it wont help you
much, however if you get in contact with me at me [at] daniel-mitchell [dot]
com I can email you the form and help you set it up.
Daniel Mitchell