| Code level: beginner Code area: Basic Outlook Printer Friendly Version | ||
| Title: Reply in HTML Format | ||
| Description: Outlook always replies to a message in the format of the incoming message. If you prefer all replies to be in HTML format, this ReplyInHTML subroutine gets the currently open or selected item, checks the format, then converts to HTML if needed. Useful techniques include using EditorType or, in Outlook 2002, BodyFormat to determine the message format, using Application.ActiveWindow to determine the current item, and using Replace to add minimal formatting to the plain text body to make it work well in HTML. | ||
| Date: 30-Dec-2002 06:49 | ||
| Code level: beginner | ||
| Code area: Basic Outlook | ||
| Posted by: Sue Mosher | ||
| Body: |
||
| All 26comments |
| Page [ 1 2 3 Next >> ] | ||
|
|
Michael Demaree
03-Jan-2003 16:14
Already posted this with much less code on 19 Dec under Outlook Design Form that does the same. Function Item_Open() TestText=Item.HTMLBODY If TestText="" Then Item.HTMLbody=Replace Item.Body,vbCrlf, "<br> " ) End Function Michael Demaree |
|
|
|
Sue Mosher
07-Jan-2003 22:01
Here's the link to the discussion that Michael started on this issue: http://www.outlookcode.com/threads.aspx?forumid=3&messageid=78 . The two applications are a little different. His code converts the item to HTML when it's opened, so that when he clicks Reply, the reply will be in HTML. Typical application would be to substitute his published form for the built-in IPM.Note form. The code above, on the other hand, does the HTML conversion on demand, only when the user wants to compose a reply. An interesting example of how the same technique can be applied in Outlook in two different ways. |
|
|
|
ares
07-Feb-2003 06:09
Hi i'm not a programmer, so how should i do to activate this function, can you tell me step by step what to do? thanks |
|
|
|
Sue Mosher
17-Feb-2003 12:42
ares, you would need to copy and paste the code above into the VBA environment in Outlook. If you are not familiar with this programming environment, you might want to start with the Back to Basics tutorial listed at http://www.slipstick.com/dev/vb.htm#tutorials . Once you've added the code, you can use Alt+F8 to bring up the list of macros and run it. |
|
|
|
Itamae Chef
02-Sep-2003 14:46
1st off, hello to everyone... Now, my problem with the aforementioned code is very simple. I have no problems using this little gem to reply to all messages in HTML format. I love the feature! The problem I have is that upon running the Macro or using my Toolbar Button to run this Macro it will spawn the reply message in a new window using a "non default" font. Let's say that again just a little simpler. When I run this Macro the font specified in the message is not what I have defined in Outlook 2002. No changes to any settings in Outlook, whether it be Stationary or anything, will effect this. It's almost random. Sometimes it's Times New..., sometimes it Ariel, etc. etc. etc. If you have any ideas how to modify this code could you please let me know. It's killing the look of my normal email and it's bugging the snot out of me to top it off. Thanks to the coders and the writers. I appreciate your work. ItamaeChef |
|
|
|
Sue Mosher
05-Sep-2003 20:14
Discussion of ItamaeChef's font issue continues at http://www.outlookcode.com/threads.aspx?forumid=2&messageid=1707 |
|
|
|
James A. Hussiere
13-Oct-2003 00:46
Hi there. I'm not much of a programmer myself, but... could this VBA be easily modified to provide a reply in Plain Text every time? (I know I can read everything in Plain Text with a registry hack in Outlook 2002 and in Outlook 2003, but I want to read in the native formats but just reply in Plain Text.) If it's possible to modify this script, what are the value names that need to substitute things like OlFormatHTML? Thanks! - James - |
|
|
|
Sue Mosher
20-Nov-2003 10:34
See http://www.outlookcode.com/codedetail.aspx?id=198 for a ReplyInPlainText routine. When in doubt about literal values of Outlook constants, check the object browser: Press ALt+F11 to open the VBA environment in Outlook, then press F2. |
|
|
|
Parisnyce
17-Dec-2004 11:55
/* ares 07-Feb-2003 06:09 Hi i'm not a programmer, so how should i do to activate this function, can you tell me step by step what to do? thanks */ Open Outlook Press Alt+F11 Press Alt+F8 Create A Sub named "ReplyInHTML" . That will focus on VB having created a Sub with name ReplyInHTML Copy and Paste Code below into your VB sub code APPROPRIATELY. Sub ReplyInHTML() Dim objItem As Object Dim objReply As MailItem Set objItem = GetCurrentItem() If objItem.GetInspector.EditorType <> olEditorHTML Then ' Outlook 2002 can substitute the next statement ' for the above If statement 'If objItem.BodyFormat <> olFormatHTML Then objItem.HTMLBody = Replace(objItem.Body, vbCrLf, "<br>") End If Set objReply = objItem.Reply objReply.Display Set objItem = Nothing Set objReply = Nothing End Sub Function GetCurrentItem() As Object Dim objApp As Application Set objApp = CreateObject("Outlook.Application") On Error Resume Next Select Case TypeName(objApp.ActiveWindow) Case "Explorer" Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1) Case "Inspector" Set GetCurrentItem = objApp.ActiveInspector.CurrentItem End Select Set objApp = Nothing End Function Save It ! Try Out ! See How it works ! You may now thank me :) Cos I spent some time to copy & paste it from the of Sue Mosher above. |
|
|
|
Julien Cohen
07-Apr-2005 02:24
Hi, I 've try this and it's works so good !! I thank you because my boss would love me when he is going to see that i find the solution he looking for since so many time. Is the same code existing for the "reply all" ? Thanks in advance ! Julien |
|
| Page [ 1 2 3 Next >> ] | ||
| Post your comment name email |
