A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Change format of a mail back to text-only



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 6th 07, 08:14 PM posted to microsoft.public.outlook.program_vba
Markus Jakobi
external usenet poster
 
Posts: 2
Default Change format of a mail back to text-only

Hi all,

maybe someone can help me.
I stumbled over an (obviously well known) problem in Outlook 2000.
The plan is to write a macro that adds some text at the end of every mail
before sending the mail. When I modify the "Item.Body" of a plain-text mail,
the format changes to Rich text. Although the mail is sent out as plain
text, it is stored as RTF in the "Sent items"-folder.

To get the old format back, I tried the following VBA-macro:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim oCtl As Office.CommandBarControl
Dim oCB As Office.CommandBar

Set oCB = Application.ActiveInspector.CommandBars("Menu Bar")
Set oCtl = oCB.Controls("Format")
Set oCtl = oCtl.Controls("Plain Text")
oCtl.Execute

Set oCtl = Nothing
Set oCB = Nothing
End Sub


But when I click the Send-button, I get a message saying that "changing the
format to plain-text removes all formatting (blabla)".
Is there any way of getting around this message? I already thought of using
SendKeys "{TAB}{ENTER}", True
after the 'oCtl.Execute', but the execution of the macro seems to stop until
the user clicks one of the buttons.

Any ideas?
Thanks in advance!


Markus


Ads
  #2  
Old March 7th 07, 07:17 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Change format of a mail back to text-only



Markus, you need to change some MAPI properties, which aren't availabe via
the Outlook object model. Here's a sample for how to do it with Redemption:
http://www.dimastr.com/redemption/faq.htm#11

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
The most effective way to assign Outlook categories:
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Tue, 6 Mar 2007 20:14:40 +0100 schrieb Markus Jakobi:

Hi all,

maybe someone can help me.
I stumbled over an (obviously well known) problem in Outlook 2000.
The plan is to write a macro that adds some text at the end of every mail
before sending the mail. When I modify the "Item.Body" of a plain-text

mail,
the format changes to Rich text. Although the mail is sent out as plain
text, it is stored as RTF in the "Sent items"-folder.

To get the old format back, I tried the following VBA-macro:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim oCtl As Office.CommandBarControl
Dim oCB As Office.CommandBar

Set oCB = Application.ActiveInspector.CommandBars("Menu Bar")
Set oCtl = oCB.Controls("Format")
Set oCtl = oCtl.Controls("Plain Text")
oCtl.Execute

Set oCtl = Nothing
Set oCB = Nothing
End Sub


But when I click the Send-button, I get a message saying that "changing

the
format to plain-text removes all formatting (blabla)".
Is there any way of getting around this message? I already thought of

using
SendKeys "{TAB}{ENTER}", True
after the 'oCtl.Execute', but the execution of the macro seems to stop

until
the user clicks one of the buttons.

Any ideas?
Thanks in advance!


Markus

  #3  
Old March 7th 07, 09:29 AM posted to microsoft.public.outlook.program_vba
Markus Jakobi
external usenet poster
 
Posts: 2
Default Change format of a mail back to text-only

Hi Michael,
thanks for your reply.

Markus, you need to change some MAPI properties, which aren't availabe via
the Outlook object model. Here's a sample for how to do it with

Redemption:

I know that it's possible to get around it using Redemption, but I'm not
using it (yet).
I was just looking for an explanation why the code stops when Outlook shows
the warning and if there is a way to change this behaviour.

I even tried another solution using (ugly) SendKeys-command. I replaced the
whole code with
SendKeys ""%txj", True
which executes the 'Format' - 'Plain Text' - 'Yes' (in the german version
of Outlook). This works fine and the code doesn't stop when Outlook shows
the warning, as long as the user doesn't use STRG+ENTER to send the
mail.


Regards -- Markus


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge - Format/Send Text and HTML Format srm Outlook - General Queries 0 January 17th 07 07:15 PM
How to permanently change the text size for HTML format messages Cliff Wang Outlook - General Queries 1 July 7th 06 03:45 PM
change format of phone field from text to phone Jim Outlook - Using Contacts 1 May 19th 06 02:29 AM
mail format to plain text autom., when replying to rtf or html mai Martinez Outlook - Installation 2 April 13th 06 09:01 PM
How to change Mail Format in Outlook Ram Add-ins for Outlook 1 March 28th 06 04:36 PM


All times are GMT +1. The time now is 08:36 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-2025 Outlook Banter.
The comments are property of their posters.