Open a custom form from code

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
 

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