Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > Open a custom form from code
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 9th April 13:53
newbie
External User
 
Posts: 1
Default Open a custom form from code


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
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666