N
Newbie
Hi,
I am using Outlook 2000 and Access XP
I want to be able to automate sending an email (from Access XP) that uses
the custom form ("HelpDesk") rather than the default email form
How can I do this?
FYI Here is the code I have for sending the email:
Sub SendMessage(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim strMessage As String
strMessage = "The following error has occured: " & vbCrLf & vbCrLf
strMessage = strMessage & "Location: " & strLocation & vbCrLf & vbCrLf
strMessage = strMessage & "Error No. " & strError & vbCrLf & vbCrLf
strMessage = strMessage & "Description: " & strDesc
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(strMailTo)
objOutlookRecip.Type = olTo
If Not Nz(strMailCc, "") = "" Then
Set objOutlookRecip = .Recipients.Add(strMailCc)
objOutlookRecip.Type = olCC
End If
.Subject = "MIS Error"
.Body = strMessage
.Importance = olImportanceHigh 'High importance
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Display
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
I am using Outlook 2000 and Access XP
I want to be able to automate sending an email (from Access XP) that uses
the custom form ("HelpDesk") rather than the default email form
How can I do this?
FYI Here is the code I have for sending the email:
Sub SendMessage(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim strMessage As String
strMessage = "The following error has occured: " & vbCrLf & vbCrLf
strMessage = strMessage & "Location: " & strLocation & vbCrLf & vbCrLf
strMessage = strMessage & "Error No. " & strError & vbCrLf & vbCrLf
strMessage = strMessage & "Description: " & strDesc
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(strMailTo)
objOutlookRecip.Type = olTo
If Not Nz(strMailCc, "") = "" Then
Set objOutlookRecip = .Recipients.Add(strMailCc)
objOutlookRecip.Type = olCC
End If
.Subject = "MIS Error"
.Body = strMessage
.Importance = olImportanceHigh 'High importance
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Display
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub