I have written a simple Macro for this, but it is somewhat special because it uses a Perl-Scriptlet. It's basicaly working like this: It encodes the mail body to HTML Entities and places it in an other HTML Body. So you are now editing a HTML Mail containing HTML code. When you start the macro the sencond time, it parses the encoded mail out, decodes it and sets it as the mail body. I think this could be done completely in VBasic, but i have written the encoding & parsing code in Perl ;-)
The macro:
Sub ShowHTML()
Static HtmlViewState As Object
Dim inspector As inspector
If HtmlViewState Is Nothing Then Set HtmlViewState = CreateObject("Scripting.Dictionary"

Set inspector = Application.ActiveInspector
If (Not HtmlViewState.exists(inspector)) Then HtmlViewState.Add inspector, 0
If (TypeName(inspector)) <> "Nothing" Then
If inspector.EditorType = olEditorHTML Then
Dim Coder As Object
Set Coder = CreateObject("Fozis.HTML.Code"
If HtmlViewState.Item(inspector) = 0 Then
inspector.CurrentItem.HTMLBody = Coder.encode(inspector.CurrentItem.HTMLBody)
HtmlViewState.Item(inspector) = 1
Else
inspector.CurrentItem.HTMLBody = Coder.decode(inspector.CurrentItem.HTMLBody)
HtmlViewState.Item(inspector) = 0
End If
End If
End If
End Sub
The main Perl code looks something like this:
my $head = "<html><head><body><pre>";
my $tail = "</pre></body></html>\n";
my $start = "<!-- Start of HTML Code -->";
my $end = "<!-- End of HTML Code -->";
sub encode
{
my $html=shift;
return $head."\n".$start."\n".HTML::Entities::encode($html)."\n".$end."\n".$tail;
}
sub decode
{
my $html = shift;
($html) = $html =~ /^.*$start\n?(.+)\n?$end.*$/s;
return HTML::Entities::decode($html);
}
I have it in a Perl-Sctipting object, but unless you have ActivePerl installed you shoud try to do these 4 lines in VBasic. ( Good luck ;-D )
Well, it works but it has some (for me, major) drawbacks. It breaks background pictures, for example. It doesn't have syntax highlighting. Outlook messes up a lot. And, I'm not using it that much than I expected.
HTH,
b.m. Fozi