B
brownc5
Hi all,
Can someone out there help. The code below creates an email with
selected data collected from a spreadsheet form. The email comes up
and can be sent fine. I need to add some functionality to the email
which is where I need the assistance. The email is sent to a manager
who can then click Authorised or Not Authorised. If Authorised is
selected I need the email to be forwarded to another address as well as
the sender. If Not Authorised is selected, the email just needs to go
back to the sender, which works fine with the standard reply. I think
it has something to with Routing slips but do not know how to make this
conditional. Can anyone help...
Sub email_test()
'
' email_test Macro
' Macro recorded 6/08/03 by brownc5
'
Dim EmailTo As String
Dim oApp As Object 'Outlook.Application
Dim oItem As Object 'Outlook.MailItem
Dim recipients As String
Dim bodytext1, bodytext2, leave_details As String
recipients = "(e-mail address removed)"
bodytext1 = "Please send to you manager to Authorise this leave"
bodytext2 = "Manager: Please use the voting buttons above to notify
payroll if this leave is authorised" & vbCrLf & "If the leave is
authorised an email will go to Payroll and " & Range("L1").Value & " "
& Range("L2") & "." & vbCrLf & "If the leave is not authorised an email
will only go to " & Range("L1").Value & " " & Range("L2") & "."
leave_details = Range("L1").Value & " " & Range("L2") & vbCrLf &
Range("L6").Value & " " & Range("L7").Value & " " & Range("L8").Value
EmailTo = recipients
Set oApp = CreateObject("Outlook.Application")
Set oItem = oApp.CreateItem(0)
With oItem
'.To = EmailTo
VotingOptions = "Authorised;Not Authorised"
Subject = "Sick Leave Form for " & Range("L1").Value & " " &
Range("L2") & ". Sent " & Format(Now(), "dd mmm yyyy hh:mm")
'.Importance = olImportanceHigh
Sensitivity = olConfidential
body = bodytext1 & vbCrLf & leave_details & vbCrLf & bodytext2
'.Attachments.Add ActiveWorkbook.FullName
Importance = 2
Display
'.Send
End With
Set oItem = Nothing
Set oApp = Nothing
'
End Sub
Regards
Craig
------------------------------------------------
------------------------------------------------
Can someone out there help. The code below creates an email with
selected data collected from a spreadsheet form. The email comes up
and can be sent fine. I need to add some functionality to the email
which is where I need the assistance. The email is sent to a manager
who can then click Authorised or Not Authorised. If Authorised is
selected I need the email to be forwarded to another address as well as
the sender. If Not Authorised is selected, the email just needs to go
back to the sender, which works fine with the standard reply. I think
it has something to with Routing slips but do not know how to make this
conditional. Can anyone help...
Sub email_test()
'
' email_test Macro
' Macro recorded 6/08/03 by brownc5
'
Dim EmailTo As String
Dim oApp As Object 'Outlook.Application
Dim oItem As Object 'Outlook.MailItem
Dim recipients As String
Dim bodytext1, bodytext2, leave_details As String
recipients = "(e-mail address removed)"
bodytext1 = "Please send to you manager to Authorise this leave"
bodytext2 = "Manager: Please use the voting buttons above to notify
payroll if this leave is authorised" & vbCrLf & "If the leave is
authorised an email will go to Payroll and " & Range("L1").Value & " "
& Range("L2") & "." & vbCrLf & "If the leave is not authorised an email
will only go to " & Range("L1").Value & " " & Range("L2") & "."
leave_details = Range("L1").Value & " " & Range("L2") & vbCrLf &
Range("L6").Value & " " & Range("L7").Value & " " & Range("L8").Value
EmailTo = recipients
Set oApp = CreateObject("Outlook.Application")
Set oItem = oApp.CreateItem(0)
With oItem
'.To = EmailTo
VotingOptions = "Authorised;Not Authorised"
Subject = "Sick Leave Form for " & Range("L1").Value & " " &
Range("L2") & ". Sent " & Format(Now(), "dd mmm yyyy hh:mm")
'.Importance = olImportanceHigh
Sensitivity = olConfidential
body = bodytext1 & vbCrLf & leave_details & vbCrLf & bodytext2
'.Attachments.Add ActiveWorkbook.FullName
Importance = 2
Display
'.Send
End With
Set oItem = Nothing
Set oApp = Nothing
'
End Sub
Regards
Craig
------------------------------------------------
------------------------------------------------