Generating an email in outlook, and disabling word as editor

O

OTWarrior

Hello to all.

I have an Access database that using the information on the forms to generate
an email (example below) and the email uses a html document as the basic
structure, changing key areas (similar to a mail merge).
Unfortunately, in one form when an email is generated, it uses alot of system
resources trying to load word as the editor for the email message. Using task
manager whilst the generation is happening to end word (not a clean or
practical way of doing it) and the email is generated ok, all I get is a
message telling me it cannot use word as it is not responding etc.

(if possible) How can I make sure the settings in outlook are set to not use
word for the editor (I tried changing my setting in outlook itself to not use
word, but somehow Access overrides it)

Any help would be much appreciated

code:

Public Function Create_Email(Email_To As String, Email_CC As String,
Email_Subject As String, Email_Body As String, Email_as_HTML As Boolean,
Email_High_Importance As Boolean, Email_View_Before_Send As Boolean,
Email_Attachment1_File As String, Email_Attachment2_File As String,
Email_Attachment3_File As String) As Boolean

Dim bResult As Boolean
Dim AddResult As Boolean
Dim MailApplication As Outlook.Application
Dim Email As Outlook.MailItem

On Error GoTo Create_Email_Error

Set MailApplication = New Outlook.Application
Set Email = MailApplication.CreateItem(olMailItem)

Email.To = Email_To 'Set the To box on the
email
Email.CC = Email_CC 'Set the CC box on the
email
Email.Subject = Email_Subject 'Set the Subject

If Email_High_Importance = False Then 'Start Set the importance
of the email
Email.Importance = olImportanceNormal
Else
Email.Importance = olImportanceHigh
End If 'End Set the Importance
of the email


If Email_as_HTML = True Then 'Start Email Body
Preference
Email.BodyFormat = olFormatHTML
Email.HTMLBody = Email_Body
Else
Email.BodyFormat = olFormatRichText
Email.body = Email_Body
End If 'End Email Body
Preference

'Process Email Attachments
If Email_Attachment1_File <> "" Then
Email.Attachments.Add (Email_Attachment1_File)
End If

If Email_Attachment2_File <> "" Then
Email.Attachments.Add (Email_Attachment2_File)
End If

If Email_Attachment3_File <> "" Then
Email.Attachments.Add (Email_Attachment3_File)
End If

'End Email Processing

'Display / Send the generated email.

If Email_View_Before_Send = True Then
Email.Display
Else
On Error Resume Next ' On Error GoTo 0
Email.Send
If Err.Number = 287 Then
Err.Clear
Call MsgBox("Please Allow Email To Me Sent!" & vbCrLf & vbCrLf &
"This Is An Essex County Council ~ SPT Inportant Email", vbExclamation,
"SPiTS ~ Allow Email")
Email.Send
If Err.Number = 287 Then
Err.Clear
Call MsgBox("Please Allow Email To Me Sent!" & vbCrLf &
vbCrLf & "This Is An Essex County Council ~ SPT Inportant Email",
vbExclamation, "SPiTS ~ Allow Email")
Email.Send
If Err.Number = 287 Then
Call MsgBox("Email Not Sent!" & vbCrLf & vbCrLf & "This
Was An Essex County Council ~ SPT Inportant Email", vbExclamation, "SPiTS ~
Email Error...")
Exit Function
End If
End If
End If
End If
'All done

Create_Email = bResult

On Error GoTo 0
Exit Function

'----------------ERROR HANDLER------------------'
Create_Email_Error:
Dim ErrorDesc As String
Dim ErrorNumber As Integer


ErrorDesc = Err.Description
ErrorNumber = Err.Number

'Send the Error Message to the Database Error Log
AddResult = AddToErrorLog(ErrorDesc, ErrorNumber, "Create_Email",
"mdl_CORE_Email")
'Present the Error to the user
Call MsgBox("The System has just experienced an error" _
& vbCrLf & "" _
& vbCrLf & "Error Number:" & ErrorNumber _
& vbCrLf & "Error Message:" & ErrorDesc _
& vbCrLf & "Module:mdl_CORE_Email" _
& vbCrLf & "Procedure:Create_Email" _
& vbCrLf & "" _
& vbCrLf & "This error message has been stored and will be
reviewed by the System Administrators, if this error is preventing you from
completing a task please discuss with the System Administrator" _
, vbExclamation, GetSystemNameLabel() + " ~ Database")


'--------------END ERROR HANDLER----------------'

End Function
 
P

Phil

What version of office do you have installed, I think I read somewhere in
2007, outlook uses Word to generate HTML I could be wrong.

Phil
 
O

OTWarrior via AccessMonster.com

fixed it, turns out the document i was referencing was originally creeated in
word, and that is why it was referencing it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top