![]() |
How to check an Outlook mail's *edit mode*?
Hi!
How to check if the ActiveInspector.CurrentItem is in *edit mode? (it's only my terminology) I would like to simply insert a text into the body of the currently opened mail (by clicking a toolbar button). But Outlook inserts the text regardless if it's in edit mode or not. (And even it saves it without a prompt) I can't find anything how to check this state. The code is something like this: 30 Set objItem = Application.ActiveInspector.CurrentItem 40 Set objInsp = objItem.GetInspector 50 If objInsp.EditorType = olEditorWord Then 60 Set objDoc = objInsp.WordEditor 70 objDoc.ActiveWindow.Selection.InsertAfter psText 80 Else 90 objItem.HTMLBody = objItem.HTMLBody & psText 100 End If Thx *** Sent via Developersdex http://www.developersdex.com *** |
How to check an Outlook mail's *edit mode*?
I don't know of a way to explicitly check for "edit mode" (aka compose
mode), but if you are working with a MailItem then objItem.Sent = False means you have a new message, reply or forward that is editable. Outlook does allow you to edit a message that you have received, so you can't assume that objItem.Sent = True always means that your item is not being edited. By the way, it would be more efficient to use Set objInsp = Application.ActiveInspector Set objItem = objInsp.CurrentItem "N More" wrote in message ... Hi! How to check if the ActiveInspector.CurrentItem is in *edit mode? (it's only my terminology) I would like to simply insert a text into the body of the currently opened mail (by clicking a toolbar button). But Outlook inserts the text regardless if it's in edit mode or not. (And even it saves it without a prompt) I can't find anything how to check this state. The code is something like this: 30 Set objItem = Application.ActiveInspector.CurrentItem 40 Set objInsp = objItem.GetInspector 50 If objInsp.EditorType = olEditorWord Then 60 Set objDoc = objInsp.WordEditor 70 objDoc.ActiveWindow.Selection.InsertAfter psText 80 Else 90 objItem.HTMLBody = objItem.HTMLBody & psText 100 End If Thx *** Sent via Developersdex http://www.developersdex.com *** |
How to check an Outlook mail's *edit mode*?
What do you mean by "edit mode"? I can think of at least three possibilities:
An unsent item? Check the MailItem.Sent property's value. An HTML or plain text format sent or received item where the user had use the Edit | Edit Message command to make the message editable? Check the Enabled property of the Edit Message command on the menu using CommandBars; see http://www.outlookcode.com/d/tips/commandbarfun.htm An RTF message send or received, with Outlook configured to use Word as the editor? I'm not sure about that one. Maybe check BodyFormat and Inspector.EditorType. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "N More" wrote in message ... Hi! How to check if the ActiveInspector.CurrentItem is in *edit mode? (it's only my terminology) I would like to simply insert a text into the body of the currently opened mail (by clicking a toolbar button). But Outlook inserts the text regardless if it's in edit mode or not. (And even it saves it without a prompt) I can't find anything how to check this state. The code is something like this: 30 Set objItem = Application.ActiveInspector.CurrentItem 40 Set objInsp = objItem.GetInspector 50 If objInsp.EditorType = olEditorWord Then 60 Set objDoc = objInsp.WordEditor 70 objDoc.ActiveWindow.Selection.InsertAfter psText 80 Else 90 objItem.HTMLBody = objItem.HTMLBody & psText 100 End If Thx *** Sent via Developersdex http://www.developersdex.com *** |
All times are GMT +1. The time now is 08:51 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com