You are here:   Home
Register   |  Login

Programmer Newsletter

Minimize

Master Programmer

Minimize

Find articles on computer software, programming, ASP.net, Sql server, databases, C#, websites, Internet, Windows, Outlook macros.

Programming Articles

Minimize
14

In Outlook 2003 you can view the Html source, but you cannot edit the html source.

Found a brilliant post with a macro to edit the html source in Outlook 2003 on Windows XP. I made a small change. Would credit the original poster, but the item was posted annonymously.

Here is my version, using my naming conventions, but I have to admit the original poster's was more readable and the instructions were simpler. Darn, someone smarter than me.

Instructions:

1. In Outlook, go to Tools, Marco, Visual Basic Editor.

2. In the Visual Basic Editor

2.A Create a new Module (not a Class module) like Edit_Html.

2.B Copy in the code below.

2.C In the Visual Basic Editor go to Tools, References. Add references to Microsoft Scripting Runtime and Windows Scripting Host Object Model.

2.D. Save

3. In Outlook, while editing an html message, press Alt + F8, select the macro Edit_Html.

Here is the code. Nice and simple.

'----------------------------------------------------
Public Sub Edit_Html()
Dim filename As String
Dim filesystem As New Scripting.FileSystemObject
Dim item As mailitem
Dim shell As New WshShell
Dim filestream As TextStream
'----------------------------------------------------
' Put html body in a file
'----------------------------------------------------
Set item = ActiveInspector.CurrentItem
filename = filesystem.GetSpecialFolder(TemporaryFolder) & "\" & filesystem.GetTempName
Set filestream = filesystem.CreateTextFile(filename, True, True)
filestream.Write filename & item.HTMLBody
filestream.Close
'----------------------------------------------------
' Read file into wordpad
'----------------------------------------------------
Set filestream = Nothing
shell.Run "wordpad.exe """ & filename & """", , True
'----------------------------------------------------
' After exiting wordpad, read file into htmlbody
'----------------------------------------------------
Set filestream = filesystem.OpenTextFile(filename, ForReading, False, TristateTrue)
item.HTMLBody = filestream.ReadAll
filestream.Close
Set filestream = Nothing
'----------------------------------------------------
' Clean up, delete temp file
'----------------------------------------------------
filesystem.DeleteFile filename
Set filesystem = Nothing
End Sub
'----------------------------------------------------

Posted in: Outlook

Post Rating

Comments

Anonymous
# Anonymous
Sunday, March 14, 2010 4:41 PM
Outlook 2003 Edit Html Source
Anonymous
# Anonymous
Thursday, March 18, 2010 10:58 PM
Death of a Hard Drive

Post Comment

Name (required)

Email (required)

Website

Programmer Newsletter

Minimize

Subscribe to the Internet Handholding newsletter

MAKE YOUR PC SUPER FAST Discover 5 Shockingly Simple Techniques That Will Make Any Old Computer Run At Top Speed.

Drive Traffic to Your Website with Article Underground. Increase Your Visitors and Your Profits.

HOW TO HYPNOTIZE ANYONE AT WILL! Amazing Secrets to Hypnotize Anyone, Anywhere, at Any Time for Whatever Reason.



Programming Bookmark

Minimize

Share/Bookmark Bookmark and Share