Re: Code to check for HTML messages being sent
- From: "Jarryd" <jarryd@xxxxxxxxxxxx>
- Date: Wed, 14 Jan 2009 17:10:24 -0000
Hi Ken,
This is what I have already tried:
------------------
Public WithEvents myItem As Outlook.MailItem
Private Sub myItem_Send(Cancel As Boolean)
MsgBox "have a great day!"
End Sub
------------------
When I send any email nothing happens. I first tried this and sent an HTML message:
------------------
Public WithEvents myItem As Outlook.MailItem
Private Sub myItem_Send(Cancel As Boolean)
If myItem.BodyFormat = olFormatHTML Then
MsgBox "have a great day!"
End if
End Sub
------------------
Neither of these is doing anything. What am I missing? Is MsgBox not a good what to check that I am trapping the even correctly? I have turned off security in Outlook 2007 by going Macro>Security>No Security...
I have also check that the Outlook VBA comm add-in is active.
Also, is it possible to edit the HTML code of the message using VBA? I would imagine it is is quite straightforward, but I have been wrong to assume so much in the past...
TIA,
Jarryd
"Ken Slovak - [MVP - Outlook]" <kenslovak@xxxxxxxx> wrote in message news:OvLjg4ldJHA.3692@xxxxxxxxxxxxxxxxxxxxxxx
Use item.BodyFormat, where item is the MailItem. That tells you the format of the email, which is one of the olBodyFormat enum members. For HTML it would be olFormatHTML..
If you want to do this on sending the item then you can trap the Item.Send event for that item. In that event save the item and then do your parsing, then let the send complete.
--
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
"Jarryd" <jarryd@xxxxxxxxxxxx> wrote in message news:ObEE2fkdJHA.1132@xxxxxxxxxxxxxxxxxxxxxxxHi,
I wanted to know if there was a way to check the format of a message in VBA? I would like to check for outgoing messages that are formatted in HTML. If they are HTML I want to then run through each line of HTML code and when one is more than 999 characters it must be broken in to two lines.
For example:
<HMTL This is the very long line of code... now at 999 characters... and now we have gone way past that...
2nd line...
This I want to change:
<HMTL This is the very long line of code... now at 999 characters...
and now we have gone way past that...
2nd line...
Any help with this would be greatly appreciated.
TIA,
Jarryd
- Follow-Ups:
- Re: Code to check for HTML messages being sent
- From: Jarryd
- Re: Code to check for HTML messages being sent
- From: Jarryd
- Re: Code to check for HTML messages being sent
- References:
- Code to check for HTML messages being sent
- From: Jarryd
- Re: Code to check for HTML messages being sent
- From: Ken Slovak - [MVP - Outlook]
- Code to check for HTML messages being sent
- Prev by Date: deleting multiple appointments
- Next by Date: Re: Code to check for HTML messages being sent
- Previous by thread: Re: Code to check for HTML messages being sent
- Next by thread: Re: Code to check for HTML messages being sent
- Index(es):
Relevant Pages
|