![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello,
With an Excel 2003 VBA procedure I send e-mails through Outlook 2003 Whenever the option of Outlook 2003 "Use Microsoft Word to edit e-mail messages" is checked my mail i made with a blank body. How can i uncheck the option using VBA and then restore it to its previous state at the end of the procedure? Same question for the second option "Use Microsoft Word to read e-mail messages with rtf format" Many thanks |
Ads |
#2
|
|||
|
|||
![]()
You can't. Outlook reads the settings from the registry and then persists
them in memory. When you change the settings the new settings are written out to the registry but not read again until Outlook closes and is restarted. So any change you make there when Outlook is running already is ignored while Outlook is running. The answer is to correctly handle WordMail when it is being used. You can always use the Body or HTMLBody properties whether or not WordMail is being used. I don't know what your code is doing but I often modify Body or HTMLBody irregardless if WordMail is being used. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "thomas" nomail wrote in message ... Hello, With an Excel 2003 VBA procedure I send e-mails through Outlook 2003 Whenever the option of Outlook 2003 "Use Microsoft Word to edit e-mail messages" is checked my mail i made with a blank body. How can i uncheck the option using VBA and then restore it to its previous state at the end of the procedure? Same question for the second option "Use Microsoft Word to read e-mail messages with rtf format" Many thanks |
#3
|
|||
|
|||
![]()
Thanks,
Hereunder my code. It always works fine excepted when the word option is checked In such a cas i only get the signature Private Function EnvoiMail_HTML(Adresse As String, Objet As String, Corps As String, Optional Pièce As String, Optional Cc As String, Optional Bcc As String, Optional Envoyer_Mail As Boolean) Dim MonAppliOutlook As Outlook.Application Dim MonMail As Outlook.MailItem Dim MaPièce As Outlook.Attachments Dim olInspector As Outlook.Inspector Set MonAppliOutlook = CreateObject("Outlook.Application") Set MonMail = MonAppliOutlook.CreateItem(olMailItem) Set olInspector = MonMail.GetInspector On Error Resume Next With MonMail If Affichage = True Then .Display Else ..GetInspector.CommandBars.Item("Insert").Controls ("Signature").Controls(1).Execute .To = Adresse If Not IsNull(Cc) Then .Cc = Cc If Not IsNull(Bcc) Then .Bcc = Bcc .Subject = Objet If Not IsNull(Pièce) Then Set MaPièce = .Attachments T = Split(Pièce, ";") For i = 0 To UBound(T) MaPièce.Add T(i), olByValue Next i End If .BodyFormat = olFormatHTML .HTMLBody = Corps & .HTMLBody If Envoyer_Mail = True Then .Send End With Set MonAppliOutlook = Nothing Set MonMail = Nothing End Function "Ken Slovak - [MVP - Outlook]" a écrit dans le message de groupe de discussion : ... You can't. Outlook reads the settings from the registry and then persists them in memory. When you change the settings the new settings are written out to the registry but not read again until Outlook closes and is restarted. So any change you make there when Outlook is running already is ignored while Outlook is running. The answer is to correctly handle WordMail when it is being used. You can always use the Body or HTMLBody properties whether or not WordMail is being used. I don't know what your code is doing but I often modify Body or HTMLBody irregardless if WordMail is being used. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "thomas" nomail wrote in message ... Hello, With an Excel 2003 VBA procedure I send e-mails through Outlook 2003 Whenever the option of Outlook 2003 "Use Microsoft Word to edit e-mail messages" is checked my mail i made with a blank body. How can i uncheck the option using VBA and then restore it to its previous state at the end of the procedure? Same question for the second option "Use Microsoft Word to read e-mail messages with rtf format" Many thanks |
#4
|
|||
|
|||
![]()
WordMail is less forgiving of HTML problems than the Outlook editor is. You
really should get the HTMLBody and then parse that string looking for the body tag and then insert your formatted HTML text into the HTMLBody string in the correct location. Then set HTMLBody back to your modified string value. Also, in WordMail that menu command isn't there, so your code should test for Inspector.IsWordMail before calling that menu command. If signatures have been set up they will be added automatically by WordMail. You can also use Inspector.WordEditor when it's WordMail to get WordEditor, which is a Word.Document object. You can then manipulate the text that way. WordMail signatures are inserted by using AutoText entries in the WordMail template, not from the Insert menu. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "thomas" nomail wrote in message ... Thanks, Hereunder my code. It always works fine excepted when the word option is checked In such a cas i only get the signature Private Function EnvoiMail_HTML(Adresse As String, Objet As String, Corps As String, Optional Pièce As String, Optional Cc As String, Optional Bcc As String, Optional Envoyer_Mail As Boolean) Dim MonAppliOutlook As Outlook.Application Dim MonMail As Outlook.MailItem Dim MaPièce As Outlook.Attachments Dim olInspector As Outlook.Inspector Set MonAppliOutlook = CreateObject("Outlook.Application") Set MonMail = MonAppliOutlook.CreateItem(olMailItem) Set olInspector = MonMail.GetInspector On Error Resume Next With MonMail If Affichage = True Then .Display Else .GetInspector.CommandBars.Item("Insert").Controls( "Signature").Controls(1).Execute .To = Adresse If Not IsNull(Cc) Then .Cc = Cc If Not IsNull(Bcc) Then .Bcc = Bcc .Subject = Objet If Not IsNull(Pièce) Then Set MaPièce = .Attachments T = Split(Pièce, ";") For i = 0 To UBound(T) MaPièce.Add T(i), olByValue Next i End If .BodyFormat = olFormatHTML .HTMLBody = Corps & .HTMLBody If Envoyer_Mail = True Then .Send End With Set MonAppliOutlook = Nothing Set MonMail = Nothing End Function |
#5
|
|||
|
|||
![]()
Thnaks but i am afraid i do not understand
"Ken Slovak - [MVP - Outlook]" a écrit dans le message de groupe de discussion : ... WordMail is less forgiving of HTML problems than the Outlook editor is. You really should get the HTMLBody and then parse that string looking for the body tag and then insert your formatted HTML text into the HTMLBody string in the correct location. Then set HTMLBody back to your modified string value. Also, in WordMail that menu command isn't there, so your code should test for Inspector.IsWordMail before calling that menu command. If signatures have been set up they will be added automatically by WordMail. You can also use Inspector.WordEditor when it's WordMail to get WordEditor, which is a Word.Document object. You can then manipulate the text that way. WordMail signatures are inserted by using AutoText entries in the WordMail template, not from the Insert menu. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "thomas" nomail wrote in message ... Thanks, Hereunder my code. It always works fine excepted when the word option is checked In such a cas i only get the signature Private Function EnvoiMail_HTML(Adresse As String, Objet As String, Corps As String, Optional Pièce As String, Optional Cc As String, Optional Bcc As String, Optional Envoyer_Mail As Boolean) Dim MonAppliOutlook As Outlook.Application Dim MonMail As Outlook.MailItem Dim MaPièce As Outlook.Attachments Dim olInspector As Outlook.Inspector Set MonAppliOutlook = CreateObject("Outlook.Application") Set MonMail = MonAppliOutlook.CreateItem(olMailItem) Set olInspector = MonMail.GetInspector On Error Resume Next With MonMail If Affichage = True Then .Display Else .GetInspector.CommandBars.Item("Insert").Controls( "Signature").Controls(1).Execute .To = Adresse If Not IsNull(Cc) Then .Cc = Cc If Not IsNull(Bcc) Then .Bcc = Bcc .Subject = Objet If Not IsNull(Pièce) Then Set MaPièce = .Attachments T = Split(Pièce, ";") For i = 0 To UBound(T) MaPièce.Add T(i), olByValue Next i End If .BodyFormat = olFormatHTML .HTMLBody = Corps & .HTMLBody If Envoyer_Mail = True Then .Send End With Set MonAppliOutlook = Nothing Set MonMail = Nothing End Function |
#6
|
|||
|
|||
![]()
What don't you understand? Please be specific, I can't just guess.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "thomas" nomail wrote in message ... Thnaks but i am afraid i do not understand |
#7
|
|||
|
|||
![]()
I just understand nothing
"Ken Slovak - [MVP - Outlook]" a écrit dans le message de groupe de discussion : ... What don't you understand? Please be specific, I can't just guess. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "thomas" nomail wrote in message ... Thnaks but i am afraid i do not understand |
#8
|
|||
|
|||
![]()
1. You are just adding your own HTML to the beginning of the existing HTML.
You need to look at the original HTML and what you end up with after you add your HTML to see if it's valid HTML syntax. 2. The menu option you are using to insert the signature isn't there in WordMail. So you have to check for WordMail being used. If it is you should avoid that code. Any automatic signatures will be added by WordMail on its own. If you want to add a signature yourself when it's WordMail you have to do it in pure HTML or have that signature set as an AutoText entry and use Word code to insert that AutoText entry. 3. If you get Inspector.WordEditor when WordMail is being used that is a Word.Document object. So you can change the text that's there using the Word object model if you want once you get that Document object. That's about as simple as I can make it. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "thomas" nomail wrote in message ... I just understand nothing |
#10
|
|||
|
|||
![]()
Dim oInspector As Outlook.Inspector
Set oInspector = MonMail.GetInspector If oInspector.IsWordMail Then ' is WordMail Else ' no WordMail End If -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "thomas" nomail wrote in message ... Thanks but how can i check with VBA if WordMail is being used or not ? i should write something like : if {wordmail is not being used} then Set olInspector = MonMail.GetInspector ? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2003 and Word as email editor - newly created emails appear under 'Word' on taskbar | KingCronos | Outlook - General Queries | 1 | October 23rd 07 09:31 PM |
turn off Word as email editor in Outlook 2007 | LaManchaDQ | Outlook - Installation | 3 | April 18th 07 02:56 PM |
Turn off and on Word as Email Editor through code | Robert Halford | Outlook and VBA | 1 | November 27th 06 06:14 AM |
How do I start WORD 2003 as my e-mail editor? Outlook freezes up . | Rick Macken | Outlook - General Queries | 1 | June 2nd 06 09:18 PM |
I cannot pick Word as my Outlook 2003 e-mail editor. | pelican1960 | Outlook - Installation | 2 | February 9th 06 10:59 PM |