In ThisOutlookSession put something like this at the module level:
Dim WithEvents colInsp As Outlook.Inspectors
Dim WithEvents oMail As Outlook.MailItem
In the Application_Startup() event handler instantiate the Inspectors
collection:
Set colInsp = Application.Inspectors
That will let you handle the NewInspector() event. In that event handler
something like this:
If Inspector.CurrentItem.Class = olMail Then
Set oMail = Inspector.CurrentItem
End If
That will let you handle the oMail.Send() event, which fires when you click
the Send button.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"p912s" <(E-Mail Removed)> wrote in message
news

(E-Mail Removed)...
<snip>
> Thanks for the reply!
>
> The above code is run from ThisOutlookSession so that when you click
> the Send button on a message you're prompted to set the sending account.
> Which as you point is to late to change the account.
>
> In that code window my only choices are General and Application... the
> only way I know I could get the Item.Send event would be to call it from
> a button on a form. And I have tried that, in the Application.Send, set
> Cancel =True and then call my form. And then from the form, set the
> sending account and try and send the message, but I get the same error.
>
> Is there any way to change the sending account after I have clicked the
> Send Button?
>
> Or can I edit the default email message and place my code behind the
> Send Button?
>
> Thanks.
>
>
> --
> p912s
> ------------------------------------------------------------------------
> p912s's Profile: http://www.thecodecage.com/forumz/member.php?userid=393
> View this thread:
> http://www.thecodecage.com/forumz/sh...d.php?t=104268
>