PDA

View Full Version : Get sending email address for appointments



charlie1105
01-26-2012, 02:58 AM
Hi All

I've got really simple code that just displays a messagebox telling me which account an email is about to be sent through, so that I don't make a mistake, as I have several different accounts.

It works fine when sending a normal email, but hits an error when I create an appointment in the calendar and try and send invitations.

Here's the code

strMsg = strMsg & "This message will be sent via the account " & Item.SendUsingAccount.DisplayName & Chr(13) & Chr(10) & "Are you sure you want to send it!"
intRes = MsgBox(strMsg, vbYesNo + vbDefaultButton2 + vbExclamation, "Do you really want to send!")
If intRes = vbNo Then
' cancel send
Cancel = True
End If

It's the Item.SendUsingAccount.DisplayName that it doesn't like!

Does anyone have any idea how to test which account an appointment is about to be sent through (I can probably figure out how to work out what type of item is being sent and use an If function to run different code depending on whether it's a normal email or an appointment)

Many thanks in advance

Charlie

JP2112
02-02-2012, 08:29 AM
I don't see any way to change the sending account when sending out anything but emails. If you discover otherwise I would be glad to hear it.