matthewnsarah07
Registered User.
- Local time
- Today, 02:16
- Joined
- Feb 19, 2008
- Messages
- 192
Just a quick one!
I have attached some code I am using below - it sends an email summary of a holiday request form using the data from the current record viewed.
Once the email has been sent via Outlook I just want a Msg Box to pop up to say it was sent succesfully with an ok button.
What code do I need to add?
-------------------------------------
Private Sub Command22_Click()
Dim mess_body As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = Me.Team_Manager
.CC = "RCCNWResourceTeam@highways.gsi.gov.uk" & ";" & Me.Staff_Name
.Subject = "RCC Leave Request Number " & [Request_Number] & " "
.Body = "Leave Request Summary as follows:" & vbCrLf & vbCrLf & "Staff Name: " & [Staff_Name] & " " & [Staff_Number] & vbCrLf & vbCrLf & "Team Manager: " & [Team_Manager] & vbCrLf & vbCrLf & "Request Type: " & [Request_Type] & vbCrLf & vbCrLf & "Date Submitted: " & [Date_of_Request] & vbCrLf & vbCrLf & "Date From: " & [Date_From] & " Date To: " & [Date To] & " Total: " & [Total Days] & vbCrLf & vbCrLf & "Type of Leave: " & [Leave_Type] & vbCrLf & "Notes: " & [Notes]
.Send
End With
'MsgBox MailOutLook.Body
Exit Sub
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
Resume Error_out
Error_out:
End Sub
I have attached some code I am using below - it sends an email summary of a holiday request form using the data from the current record viewed.
Once the email has been sent via Outlook I just want a Msg Box to pop up to say it was sent succesfully with an ok button.
What code do I need to add?
-------------------------------------
Private Sub Command22_Click()
Dim mess_body As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = Me.Team_Manager
.CC = "RCCNWResourceTeam@highways.gsi.gov.uk" & ";" & Me.Staff_Name
.Subject = "RCC Leave Request Number " & [Request_Number] & " "
.Body = "Leave Request Summary as follows:" & vbCrLf & vbCrLf & "Staff Name: " & [Staff_Name] & " " & [Staff_Number] & vbCrLf & vbCrLf & "Team Manager: " & [Team_Manager] & vbCrLf & vbCrLf & "Request Type: " & [Request_Type] & vbCrLf & vbCrLf & "Date Submitted: " & [Date_of_Request] & vbCrLf & vbCrLf & "Date From: " & [Date_From] & " Date To: " & [Date To] & " Total: " & [Total Days] & vbCrLf & vbCrLf & "Type of Leave: " & [Leave_Type] & vbCrLf & "Notes: " & [Notes]
.Send
End With
'MsgBox MailOutLook.Body
Exit Sub
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
Resume Error_out
Error_out:
End Sub