Attribute VB_Name = "HTML_copy_paste"
' HTML copy/paste
' by unknown
' more info: http://mll2.free.fr/?p=192
'Changelog
'V1.0 2008-12-04
'- First re-release
'
Option Explicit
Const tmpHtmlFile As String = "msgtmp.html" 'the temporary HTML file
Const editHtml As String = "notepad.exe" 'my text editor
Sub HTMLcopy()
Dim tmpHtml As String
tmpHtml = VBA.Environ$("TEMP") & "\" & tmpHtmlFile 'the temporary HTML file
Dim fs, f, s As String
' pull out the HTML representation of the current message
s = Application.ActiveInspector.CurrentItem.HTMLBody
' write that to a text file
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile(tmpHtml, True)
f.Write s
f.Close
' call the editor
Shell editHtml & " " & tmpHtml, vbNormalFocus
End Sub
Sub HTMLpaste()
Dim tmpHtml As String
tmpHtml = VBA.Environ$("TEMP") & "\" & tmpHtmlFile 'the temporary HTML file
Dim s As String, fs, f
' read in the text file
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.opentextfile(tmpHtml, 1)
s = f.ReadAll
f.Close
' stuff the result back into the message
Application.ActiveInspector.CurrentItem.HTMLBody = s
End Sub