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=Arial><font size=2><color=#000000>Hello
Everyone,<br /><br />" & _
"<span style=background-color:#FF0000><font
color=#FFFFFF>Red</span><br />" & _
"<font color=#FFFFFF>Testing 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
:
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
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=Arial><font
size=2><color=#000000>Hello
Everyone,<br /><br />" & _
"<span style=background-color:#FF0000><font
color=#FFFFFF>Red</span>" & _
"<font color=#4B0082> = Hello new line.<br /> " & _
"<font color=#FF00FF>Testing<br />" & _
"<font color=#000000><dir>" & _
"<li>Line <b>2</b></dir><br />" & _
"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
:
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/legault/archive/2004/08/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
message
Hello,
This is a follow-up post to what I have posted on another forum
(please
see:
http://www.microsoft.com/communitie...ming&mid=5c23ec0c-60ed-4b43-9302-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