I can paste an Outlook email message into a Web page using the following code.
VBA
Sub HTMLClipboard()
Dim M As MailItem, Buf As MSForms.DataObject
Set M = ActiveExplorer().Selection.Item(1)
Set Buf = New MSForms.DataObject
Buf.SetText M.HTMLBody
Buf.PutInClipboard
End Sub
HTML
<div id="Data"></div>
<textarea id="TA"></textarea>
jQuery
$(document).on('paste', function(e) {
$('#TA').focus();
setTimeout(function() {
$('#Data')
.html($('#TA').val());
});
});
This works great unless there's an image in the HTMLBody. In that situation, I get a broken image src like this:
<img width=596 height=381
id="Picture_x0020_1"
src="cid:image001.png@01D07855.C2524830"
>
Is there a way to encode image data within the VBA function, preferably as a Data URI?