![]() |
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,
This is a follow-up post to what I have posted on another forum (please see: http://www.microsoft.com/communities...2-81c2d86f3a13 ); I was wondering if anyone here might have come across a similar question. I have thumbed through the threads that I thought were relevant and have tried a few variations but without any success. What I am attempting to do is confirm through VBA whether or not someone has the ‘Use Microsoft Office Word 2003 to edit e-mail messages’ option selected from their Outlook 2003 profile. The script that Ron devolved has a caveat where the ‘RangeToHTML’ function (see http://www.rondebruin.nl/mail/folder3/mail4.htm for detail) will not work if that option is selected. If the person has that option ‘active’ have the script turn it off .. if they don’t then the script will run as normal. Then at the end put it back the way their options were of course; assuming since it’s a script it won’t actually ‘change’ the end users Outlook settings. My problem stems from not understanding how to call ‘IsWordEditor’ module / class / etc correctly from Excel’s VBA GUI. Thank you in advance for your help, J |
Ads |
#2
|
|||
|
|||
![]()
You can check if Inspector.WordEditor is a null object. That property
equates to the Document object in Word. You can also check and change these settings in the registry: Eric Legault My Eggo : Outlook's Message Format Settings In The Registry: http://blogs.officezealot.com/legaul...8/03/1324.aspx -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Hello, This is a follow-up post to what I have posted on another forum (please see: http://www.microsoft.com/communities...2-81c2d86f3a13 ); I was wondering if anyone here might have come across a similar question. I have thumbed through the threads that I thought were relevant and have tried a few variations but without any success. What I am attempting to do is confirm through VBA whether or not someone has the ‘Use Microsoft Office Word 2003 to edit e-mail messages’ option selected from their Outlook 2003 profile. The script that Ron devolved has a caveat where the ‘RangeToHTML’ function (see http://www.rondebruin.nl/mail/folder3/mail4.htm for detail) will not work if that option is selected. If the person has that option ‘active’ have the script turn it off .. if they don’t then the script will run as normal. Then at the end put it back the way their options were of course; assuming since it’s a script it won’t actually ‘change’ the end users Outlook settings. My problem stems from not understanding how to call ‘IsWordEditor’ module / class / etc correctly from Excel’s VBA GUI. Thank you in advance for your help, J |
#3
|
|||
|
|||
![]()
Eric,
Thank you for your quick reply, I have included a copy of the code I am working with so I can detail what error(s) I am getting. I am using Excel 2003 with Outlook 2003 running on XP Pro SP2 (please see below) This is the problem I am running into, I am unable to call the 'Inspector.WordEditor' correctly, - If I 'Set TestOutlookEditor = ActiveInspector("Outlook.Application")' and I go to 'Debug Compile VBAProject'. I get error msg 'Compile error: Sub or Function not defined' .. the debug highlights the word 'ActiveInsepctor' - if I 'Set TestEditor = Inspector.WordEditor("Word.Application")' I get error msg 'Run-time errror '424': Object required' .. if I 'MouseOver' the word 'TestEditor' the debug says 'TestEditor = Empty' My theory is this: if I can confirm that the end user (person running script) has their's set to 'True' then I can get the script to work then Ron's email script will work correctly, if the user has it set to 'False' then the script will run without any troubles. Sorry for not clarifing earlier. Sub TestHTMLEmailEditor_MSDN() '************ Test Code ' This creates an email with a preset list of people who request the data. Dim TestHTMLString As String Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) ' ****Test variable(s) to check Outlook msg formatting .. currently not working 'Set TestOutlookEditor = ActiveInspector("Outlook.Application") 'set option not working .. commenting out Set TestEditor = Inspector.WordEditor("Word.Application") ' Below is the section of code I am unable to get to work ' ********************** If TestEditor.Inspector.WordEditor = Null Then MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If ' ********************** End of test code TestHTMLString = "font face=Arialfont size=2color=#000000Hello Everyone,br /br /" & _ "span style=background-color:#FF0000font color=#FFFFFFRed/span" & _ "font color=#4B0082 = Hello new line.br / " & _ "font color=#FF00FFTestingbr /" & _ "font color=#000000dir" & _ "liLine b2/b/dirbr /" & _ "Testing new line" With MItem .To = "" .CC = "" .Subject = "Test Email using HTML on " & Format(Now, "dddd mm/dd/yy") .htmlBody = TestHTMLString .Display ' This allows the email to show vs auto sending End With Set OutlookApp = Nothing Set MItem = Nothing End Sub "Eric Legault [MVP - Outlook]" wrote: You can check if Inspector.WordEditor is a null object. That property equates to the Document object in Word. You can also check and change these settings in the registry: Eric Legault My Eggo : Outlook's Message Format Settings In The Registry: http://blogs.officezealot.com/legaul...8/03/1324.aspx -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Hello, This is a follow-up post to what I have posted on another forum (please see: http://www.microsoft.com/communities...2-81c2d86f3a13 ); I was wondering if anyone here might have come across a similar question. I have thumbed through the threads that I thought were relevant and have tried a few variations but without any success. What I am attempting to do is confirm through VBA whether or not someone has the ‘Use Microsoft Office Word 2003 to edit e-mail messages’ option selected from their Outlook 2003 profile. The script that Ron devolved has a caveat where the ‘RangeToHTML’ function (see http://www.rondebruin.nl/mail/folder3/mail4.htm for detail) will not work if that option is selected. If the person has that option ‘active’ have the script turn it off .. if they don’t then the script will run as normal. Then at the end put it back the way their options were of course; assuming since it’s a script it won’t actually ‘change’ the end users Outlook settings. My problem stems from not understanding how to call ‘IsWordEditor’ module / class / etc correctly from Excel’s VBA GUI. Thank you in advance for your help, J |
#4
|
|||
|
|||
![]()
Eric,
I implemented the code you suggested into my procedure and I am able to 'debug Compile VBAProject' without any troubles errors. What I am running into is that when I step through the code (regardless if I have Word 2003 as my email editor selected or not) 'objWordDoc' always returns 'objWordDoc = nothing' .. I have included my updated code (shortened slightly for space reasons) so you see what I see. Thank you agian for your time, Sub TestHTMLEmailEditor_MSDN() Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) Dim TestHTMLString As String Dim objWordDoc As Word.Document Set objWordDoc = ActiveInspector.WordEditor If objWordDoc Is Nothing Then MsgBox ("Word 2003 is NOT selected") Else MsgBox ("Word 2003 is the active email editor") 'This is Word Mail! End If TestHTMLString = "font face=Arialfont size=2color=#000000Hello Everyone,br /br /" & _ "span style=background-color:#FF0000font color=#FFFFFFRed/spanbr /" & _ "font color=#FFFFFFTesting new line" With MItem .To = "" .htmlBody = TestHTMLString .Display ' This allows the email to show vs auto sending End With Set OutlookApp = Nothing Set MItem = Nothing Set objWordDoc = Nothing End Sub "Eric Legault [MVP - Outlook]" wrote: This is how you should be testing: Dim objWordDoc As Word.Document 'Make sure you have a reference set to the Microsoft Word 2003 Object Model Set objWordDoc = ActiveInspector.WordEditor If objWordDoc Is Nothing Then 'This isn't Word Mail Else 'This is Word Mail! End If -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Eric, Thank you for your quick reply, I have included a copy of the code I am working with so I can detail what error(s) I am getting. I am using Excel 2003 with Outlook 2003 running on XP Pro SP2 (please see below) This is the problem I am running into, I am unable to call the 'Inspector.WordEditor' correctly, - If I 'Set TestOutlookEditor = ActiveInspector("Outlook.Application")' and I go to 'Debug Compile VBAProject'. I get error msg 'Compile error: Sub or Function not defined' .. the debug highlights the word 'ActiveInsepctor' - if I 'Set TestEditor = Inspector.WordEditor("Word.Application")' I get error msg 'Run-time errror '424': Object required' .. if I 'MouseOver' the word 'TestEditor' the debug says 'TestEditor = Empty' My theory is this: if I can confirm that the end user (person running script) has their's set to 'True' then I can get the script to work then Ron's email script will work correctly, if the user has it set to 'False' then the script will run without any troubles. Sorry for not clarifing earlier. Sub TestHTMLEmailEditor_MSDN() '************ Test Code ' This creates an email with a preset list of people who request the data. Dim TestHTMLString As String Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) ' ****Test variable(s) to check Outlook msg formatting .. currently not working 'Set TestOutlookEditor = ActiveInspector("Outlook.Application") 'set option not working .. commenting out Set TestEditor = Inspector.WordEditor("Word.Application") ' Below is the section of code I am unable to get to work ' ********************** If TestEditor.Inspector.WordEditor = Null Then MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If ' ********************** End of test code TestHTMLString = "font face=Arialfont size=2color=#000000Hello Everyone,br /br /" & _ "span style=background-color:#FF0000font color=#FFFFFFRed/span" & _ "font color=#4B0082 = Hello new line.br / " & _ "font color=#FF00FFTestingbr /" & _ "font color=#000000dir" & _ "liLine b2/b/dirbr /" & _ "Testing new line" With MItem .To = "" .CC = "" .Subject = "Test Email using HTML on " & Format(Now, "dddd mm/dd/yy") .htmlBody = TestHTMLString .Display ' This allows the email to show vs auto sending End With Set OutlookApp = Nothing Set MItem = Nothing End Sub "Eric Legault [MVP - Outlook]" wrote: You can check if Inspector.WordEditor is a null object. That property equates to the Document object in Word. You can also check and change these settings in the registry: Eric Legault My Eggo : Outlook's Message Format Settings In The Registry: http://blogs.officezealot.com/legaul...8/03/1324.aspx -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Hello, This is a follow-up post to what I have posted on another forum (please see: http://www.microsoft.com/communities...2-81c2d86f3a13 ); I was wondering if anyone here might have come across a similar question. I have thumbed through the threads that I thought were relevant and have tried a few variations but without any success. What I am attempting to do is confirm through VBA whether or not someone has the ‘Use Microsoft Office Word 2003 to edit e-mail messages’ option selected from their Outlook 2003 profile. The script that Ron devolved has a caveat where the ‘RangeToHTML’ function (see http://www.rondebruin.nl/mail/folder3/mail4.htm for detail) will not work if that option is selected. If the person has that option ‘active’ have the script turn it off .. if they don’t then the script will run as normal. Then at the end put it back the way their options were of course; assuming since it’s a script it won’t actually ‘change’ the end users Outlook settings. My problem stems from not understanding how to call ‘IsWordEditor’ module / class / etc correctly from Excel’s VBA GUI. Thank you in advance for your help, J |
#5
|
|||
|
|||
![]()
Eric,
Sorry for the delay in the response, I have attempted to use the suggestion you gave to 'produce an active inspector window' using a with statement (see below). Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) Set TestOutlookEditor = ActiveInspector("Outlook.Application") With mItem .display ‘creates a blank email If TestOutlookEditor.IsWordEditor = True Then MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If End with I hate to say it but, at this point I am a little above my head trying to figure out the command string needed to get the code to return a 'true / false' or whatever would be needed so I can toggle the editor on / off. Please let me know if you have any sample code that can retrieve the editor. Thank you again for your time, J "Eric Legault [MVP - Outlook]" wrote: Are you sure you have an e-mail open? The Set MItem = OutlookApp.CreateItem(olMailItem) call does not produce an active inspector window until you cal MItem.Display. You don't have error handling turned off so you *should* get an error with the Set objWordDoc = ActiveInspector.WordEditor call because ActiveInspector would be Nothing if there's no open message. -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Eric, I implemented the code you suggested into my procedure and I am able to 'debug Compile VBAProject' without any troubles errors. What I am running into is that when I step through the code (regardless if I have Word 2003 as my email editor selected or not) 'objWordDoc' always returns 'objWordDoc = nothing' .. I have included my updated code (shortened slightly for space reasons) so you see what I see. Thank you agian for your time, Sub TestHTMLEmailEditor_MSDN() Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) Dim TestHTMLString As String Dim objWordDoc As Word.Document Set objWordDoc = ActiveInspector.WordEditor If objWordDoc Is Nothing Then MsgBox ("Word 2003 is NOT selected") Else MsgBox ("Word 2003 is the active email editor") 'This is Word Mail! End If TestHTMLString = "font face=Arialfont size=2color=#000000Hello Everyone,br /br /" & _ "span style=background-color:#FF0000font color=#FFFFFFRed/spanbr /" & _ "font color=#FFFFFFTesting new line" With MItem .To = "" .htmlBody = TestHTMLString .Display ' This allows the email to show vs auto sending End With Set OutlookApp = Nothing Set MItem = Nothing Set objWordDoc = Nothing End Sub "Eric Legault [MVP - Outlook]" wrote: This is how you should be testing: Dim objWordDoc As Word.Document 'Make sure you have a reference set to the Microsoft Word 2003 Object Model Set objWordDoc = ActiveInspector.WordEditor If objWordDoc Is Nothing Then 'This isn't Word Mail Else 'This is Word Mail! End If -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Eric, Thank you for your quick reply, I have included a copy of the code I am working with so I can detail what error(s) I am getting. I am using Excel 2003 with Outlook 2003 running on XP Pro SP2 (please see below) This is the problem I am running into, I am unable to call the 'Inspector.WordEditor' correctly, - If I 'Set TestOutlookEditor = ActiveInspector("Outlook.Application")' and I go to 'Debug Compile VBAProject'. I get error msg 'Compile error: Sub or Function not defined' .. the debug highlights the word 'ActiveInsepctor' - if I 'Set TestEditor = Inspector.WordEditor("Word.Application")' I get error msg 'Run-time errror '424': Object required' .. if I 'MouseOver' the word 'TestEditor' the debug says 'TestEditor = Empty' My theory is this: if I can confirm that the end user (person running script) has their's set to 'True' then I can get the script to work then Ron's email script will work correctly, if the user has it set to 'False' then the script will run without any troubles. Sorry for not clarifing earlier. Sub TestHTMLEmailEditor_MSDN() '************ Test Code ' This creates an email with a preset list of people who request the data. Dim TestHTMLString As String Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) ' ****Test variable(s) to check Outlook msg formatting .. currently not working 'Set TestOutlookEditor = ActiveInspector("Outlook.Application") 'set option not working .. commenting out Set TestEditor = Inspector.WordEditor("Word.Application") ' Below is the section of code I am unable to get to work ' ********************** If TestEditor.Inspector.WordEditor = Null Then MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If ' ********************** End of test code TestHTMLString = "font face=Arialfont size=2color=#000000Hello Everyone,br /br /" & _ "span style=background-color:#FF0000font color=#FFFFFFRed/span" & _ "font color=#4B0082 = Hello new line.br / " & _ "font color=#FF00FFTestingbr /" & _ "font color=#000000dir" & _ "liLine b2/b/dirbr /" & _ "Testing new line" With MItem .To = "" .CC = "" .Subject = "Test Email using HTML on " & Format(Now, "dddd mm/dd/yy") .htmlBody = TestHTMLString .Display ' This allows the email to show vs auto sending End With Set OutlookApp = Nothing Set MItem = Nothing End Sub "Eric Legault [MVP - Outlook]" wrote: You can check if Inspector.WordEditor is a null object. That property equates to the Document object in Word. You can also check and change these settings in the registry: Eric Legault My Eggo : Outlook's Message Format Settings In The Registry: http://blogs.officezealot.com/legaul...8/03/1324.aspx -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Hello, This is a follow-up post to what I have posted on another forum (please see: http://www.microsoft.com/communities...2-81c2d86f3a13 ); I was wondering if anyone here might have come across a similar question. I have thumbed through the threads that I thought were relevant and have tried a few variations but without any success. What I am attempting to do is confirm through VBA whether or not someone has the ‘Use Microsoft Office Word 2003 to edit e-mail messages’ option selected from their Outlook 2003 profile. The script that Ron devolved has a caveat where the ‘RangeToHTML’ function (see http://www.rondebruin.nl/mail/folder3/mail4.htm for detail) will not work if that option is selected. If the person has that option ‘active’ have the script turn it off .. if they don’t then the script will run as normal. Then at the end put it back the way their options were of course; assuming since it’s a script it won’t actually ‘change’ the end users Outlook settings. My problem stems from not understanding how to call ‘IsWordEditor’ module / class / etc correctly from Excel’s VBA GUI. Thank you in advance for your help, J |
#6
|
|||
|
|||
![]()
The problem is the "IsWordEditor" method you're calling - there's no such
thing! Also, call ActiveInspector as below, and *after* the e-mail is displayed: Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) With mItem ..display 'creates a blank email Set TestOutlookEditor = Application.ActiveInspector If TestOutlookEditor.EditorType = 4 Then '= olEditorType.olEditorWord MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If End with -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Eric, Sorry for the delay in the response, I have attempted to use the suggestion you gave to 'produce an active inspector window' using a with statement (see below). Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) Set TestOutlookEditor = ActiveInspector("Outlook.Application") With mItem .display ‘creates a blank email If TestOutlookEditor.IsWordEditor = True Then MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If End with I hate to say it but, at this point I am a little above my head trying to figure out the command string needed to get the code to return a 'true / false' or whatever would be needed so I can toggle the editor on / off. Please let me know if you have any sample code that can retrieve the editor. Thank you again for your time, J "Eric Legault [MVP - Outlook]" wrote: Are you sure you have an e-mail open? The Set MItem = OutlookApp.CreateItem(olMailItem) call does not produce an active inspector window until you cal MItem.Display. You don't have error handling turned off so you *should* get an error with the Set objWordDoc = ActiveInspector.WordEditor call because ActiveInspector would be Nothing if there's no open message. -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Eric, I implemented the code you suggested into my procedure and I am able to 'debug Compile VBAProject' without any troubles errors. What I am running into is that when I step through the code (regardless if I have Word 2003 as my email editor selected or not) 'objWordDoc' always returns 'objWordDoc = nothing' .. I have included my updated code (shortened slightly for space reasons) so you see what I see. Thank you agian for your time, Sub TestHTMLEmailEditor_MSDN() Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) Dim TestHTMLString As String Dim objWordDoc As Word.Document Set objWordDoc = ActiveInspector.WordEditor If objWordDoc Is Nothing Then MsgBox ("Word 2003 is NOT selected") Else MsgBox ("Word 2003 is the active email editor") 'This is Word Mail! End If TestHTMLString = "font face=Arialfont size=2color=#000000Hello Everyone,br /br /" & _ "span style=background-color:#FF0000font color=#FFFFFFRed/spanbr /" & _ "font color=#FFFFFFTesting new line" With MItem .To = "" .htmlBody = TestHTMLString .Display ' This allows the email to show vs auto sending End With Set OutlookApp = Nothing Set MItem = Nothing Set objWordDoc = Nothing End Sub "Eric Legault [MVP - Outlook]" wrote: This is how you should be testing: Dim objWordDoc As Word.Document 'Make sure you have a reference set to the Microsoft Word 2003 Object Model Set objWordDoc = ActiveInspector.WordEditor If objWordDoc Is Nothing Then 'This isn't Word Mail Else 'This is Word Mail! End If -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Eric, Thank you for your quick reply, I have included a copy of the code I am working with so I can detail what error(s) I am getting. I am using Excel 2003 with Outlook 2003 running on XP Pro SP2 (please see below) This is the problem I am running into, I am unable to call the 'Inspector.WordEditor' correctly, - If I 'Set TestOutlookEditor = ActiveInspector("Outlook.Application")' and I go to 'Debug Compile VBAProject'. I get error msg 'Compile error: Sub or Function not defined' .. the debug highlights the word 'ActiveInsepctor' - if I 'Set TestEditor = Inspector.WordEditor("Word.Application")' I get error msg 'Run-time errror '424': Object required' .. if I 'MouseOver' the word 'TestEditor' the debug says 'TestEditor = Empty' My theory is this: if I can confirm that the end user (person running script) has their's set to 'True' then I can get the script to work then Ron's email script will work correctly, if the user has it set to 'False' then the script will run without any troubles. Sorry for not clarifing earlier. Sub TestHTMLEmailEditor_MSDN() '************ Test Code ' This creates an email with a preset list of people who request the data. Dim TestHTMLString As String Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) ' ****Test variable(s) to check Outlook msg formatting .. currently not working 'Set TestOutlookEditor = ActiveInspector("Outlook.Application") 'set option not working .. commenting out Set TestEditor = Inspector.WordEditor("Word.Application") ' Below is the section of code I am unable to get to work ' ********************** If TestEditor.Inspector.WordEditor = Null Then MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If ' ********************** End of test code TestHTMLString = "font face=Arialfont size=2color=#000000Hello Everyone,br /br /" & _ "span style=background-color:#FF0000font color=#FFFFFFRed/span" & _ "font color=#4B0082 = Hello new line.br / " & _ "font color=#FF00FFTestingbr /" & _ "font color=#000000dir" & _ "liLine b2/b/dirbr /" & _ "Testing new line" With MItem .To = "" .CC = "" .Subject = "Test Email using HTML on " & Format(Now, "dddd mm/dd/yy") .htmlBody = TestHTMLString .Display ' This allows the email to show vs auto sending End With Set OutlookApp = Nothing Set MItem = Nothing End Sub "Eric Legault [MVP - Outlook]" wrote: You can check if Inspector.WordEditor is a null object. That property equates to the Document object in Word. You can also check and change these settings in the registry: Eric Legault My Eggo : Outlook's Message Format Settings In The Registry: http://blogs.officezealot.com/legaul...8/03/1324.aspx -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault "J Smith 555" wrote in message ... Hello, This is a follow-up post to what I have posted on another forum (please see: http://www.microsoft.com/communities...2-81c2d86f3a13 ); I was wondering if anyone here might have come across a similar question. I have thumbed through the threads that I thought were relevant and have tried a few variations but without any success. What I am attempting to do is confirm through VBA whether or not someone has the ‘Use Microsoft Office Word 2003 to edit e-mail messages’ option selected from their Outlook 2003 profile. The script that Ron devolved has a caveat where the ‘RangeToHTML’ function (see http://www.rondebruin.nl/mail/folder3/mail4.htm for detail) will not work if that option is selected. If the person has that option ‘active’ have the script turn it off .. if they don’t then the script will run as normal. Then at the end put it back the way their options were of course; assuming since it’s a script it won’t actually ‘change’ the end users Outlook settings. My problem stems from not understanding how to call ‘IsWordEditor’ module / class / etc correctly from Excel’s VBA GUI. Thank you in advance for your help, J |
#7
|
|||
|
|||
![]()
Eric,
Sorry for the long delay in response, I added the below code as suggest but when I run it I am getting an error msg: Run-time error '438': Object doesn't support this property or method When i dubug it highlights the line: Set TestOutlookEditor = Application.ActiveInspector and says that the 'TestOutlookEditor = Empty' .. I have attempted to 'Dim TestOutlookEditor as Object (and Variant)' without any luck. Am I missing something ?? Thank you agian for your time and help with this, Jason "Eric Legault [MVP - Outlook]" wrote: The problem is the "IsWordEditor" method you're calling - there's no such thing! Also, call ActiveInspector as below, and *after* the e-mail is displayed: Set OutlookApp = CreateObject("Outlook.Application") Set MItem = OutlookApp.CreateItem(olMailItem) With mItem .display 'creates a blank email Set TestOutlookEditor = Application.ActiveInspector If TestOutlookEditor.EditorType = 4 Then '= olEditorType.olEditorWord MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If End with -- Eric Legault [MVP - Outlook] MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007 & WSS 3.0 Application Development) President Collaborative Innovations - Try Picture Attachments Wizard 2.0 For Microsoft Outlook - - Take your SharePoint content offline - - More info: http://www.collaborativeinnovations.ca - Blog: http://blogs.officezealot.com/legault |
#8
|
|||
|
|||
![]()
If this code is running in the Outlook VBA project then Application means
Outlook.Application. If it's running somewhere else Application.ActiveInspector means nothing. If you have an Outlook.Application object OutlookApp then you should use OutlookApp.ActiveInspector instead. -- 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 "J Smith 555" wrote in message ... Eric, Sorry for the long delay in response, I added the below code as suggest but when I run it I am getting an error msg: Run-time error '438': Object doesn't support this property or method When i dubug it highlights the line: Set TestOutlookEditor = Application.ActiveInspector and says that the 'TestOutlookEditor = Empty' .. I have attempted to 'Dim TestOutlookEditor as Object (and Variant)' without any luck. Am I missing something ?? Thank you agian for your time and help with this, Jason |
#9
|
|||
|
|||
![]()
Ken,
Sorry for not clarifying on my previous post. I am running the below code on WIN XP SP2 / Excel '03 .. which is calling Outlook to send the email. I am getting the same error on the same line of code (If OutlookApp.ActiveInspector = True Then ..) My Code: Sub Test() Set OutlookApp = CreateObject("Outlook.Application") Set mItem = OutlookApp.CreateItem(olMailItem) With mItem .display 'creates a blank email If OutlookApp.ActiveInspector = True Then ‘ Error ‘438 OutlookApp.ActiveInspector = False 'Turn off ActiveInspector MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If End With End Sub The overall goal is to send an email (through Excel) using .HTMLbody formatting then attach inside the same body of the email a range of cells with some formatting (ie a small layout of data) then more text using HTML. On Ron’s website (Link : http://www.rondebruin.nl/mail/folder3/mail4.htm) he mentions this : bNote: This is not working if Word is your mail editor, you can change this setting in Outlook: ToolsOptions…Mail Format tab /b There might be some other code out there but I have yet to come across it .. What I was attempting to do using this post was to find out from using Excel to call Outlook then determine if the WordEditor is active or not .. if its active turn it off then use Ron's code to do what I want. The downside is the code I'm working on will be used by others and I am trying to make sure that the code is flexible enough to determine if WordEditor is active and make the needed changes for the script to run correctly. I have more experience with Excel VBA than Outlook VBA .. so I’m really lost when it comes to the call functions and the syntax associated with Outlook. :-( If you know of some other code out there or can suggest another forum that might steer by in the right direction let me know and I'll keep hunting. :-D Thank you again for your time, any suggestions is greatly appreciated. Jason "Ken Slovak - [MVP - Outlook]" wrote: If this code is running in the Outlook VBA project then Application means Outlook.Application. If it's running somewhere else Application.ActiveInspector means nothing. If you have an Outlook.Application object OutlookApp then you should use OutlookApp.ActiveInspector instead. -- 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 "J Smith 555" wrote in message ... Eric, Sorry for the long delay in response, I added the below code as suggest but when I run it I am getting an error msg: Run-time error '438': Object doesn't support this property or method When i dubug it highlights the line: Set TestOutlookEditor = Application.ActiveInspector and says that the 'TestOutlookEditor = Empty' .. I have attempted to 'Dim TestOutlookEditor as Object (and Variant)' without any luck. Am I missing something ?? Thank you agian for your time and help with this, Jason |
#10
|
|||
|
|||
![]()
I don't understand that code at all. ActiveInspector is an object, an
Inspector that happens to be active. It isn't a Boolean. It can be Nothing or not but why are you trying to coerce it to a Boolean? I'd either use a test like this: If (OutlookApp.ActiveInspector Is Nothing) Then or something like this: If (OutlookApp.Inspectors.Count 0) Then 'there is at least one Inspector open -- 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 "J Smith 555" wrote in message ... Ken, Sorry for not clarifying on my previous post. I am running the below code on WIN XP SP2 / Excel '03 .. which is calling Outlook to send the email. I am getting the same error on the same line of code (If OutlookApp.ActiveInspector = True Then ..) My Code: Sub Test() Set OutlookApp = CreateObject("Outlook.Application") Set mItem = OutlookApp.CreateItem(olMailItem) With mItem .display 'creates a blank email If OutlookApp.ActiveInspector = True Then ‘ Error ‘438 OutlookApp.ActiveInspector = False 'Turn off ActiveInspector MsgBox ("Pass") ' confirmation from Excel if value is true Else MsgBox ("Failed") ' confirmation from Excel if value is False End If End With End Sub The overall goal is to send an email (through Excel) using .HTMLbody formatting then attach inside the same body of the email a range of cells with some formatting (ie a small layout of data) then more text using HTML. On Ron’s website (Link : http://www.rondebruin.nl/mail/folder3/mail4.htm) he mentions this : bNote: This is not working if Word is your mail editor, you can change this setting in Outlook: ToolsOptions…Mail Format tab /b There might be some other code out there but I have yet to come across it .. What I was attempting to do using this post was to find out from using Excel to call Outlook then determine if the WordEditor is active or not .. if its active turn it off then use Ron's code to do what I want. The downside is the code I'm working on will be used by others and I am trying to make sure that the code is flexible enough to determine if WordEditor is active and make the needed changes for the script to run correctly. I have more experience with Excel VBA than Outlook VBA .. so I’m really lost when it comes to the call functions and the syntax associated with Outlook. :-( If you know of some other code out there or can suggest another forum that might steer by in the right direction let me know and I'll keep hunting. :-D Thank you again for your time, any suggestions is greatly appreciated. Jason |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can't set Word as email editor in Outlook 2003 | Jim[_7_] | Outlook - General Queries | 9 | February 20th 08 02:28 PM |
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 |
How to set Word as email editor in Outlook 2007 | LurfysMa | Outlook - General Queries | 1 | May 10th 07 02:12 AM |
How do I link outlook events to Word being used as email editor? | Graybane | Outlook and VBA | 2 | February 28th 07 02:06 PM |
can't find word as email editor in outlook | Debbie | Outlook - Installation | 2 | October 5th 06 02:13 PM |