LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional email sending

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 = "
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



------------------------------------------------
Message posted from the Excel Tip Forum at http://www.ExcelTip.com/forum/

-- View and post usenet messages directly from http://www.ExcelTip.com
-- Hundreds of free MS Excel tips, tricks and solutions
------------------------------------------------
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending a group email Newbee Excel Worksheet Functions 9 February 11th 10 05:47 PM
sending email to several contacts? L.S. Excel Discussion (Misc queries) 2 November 24th 09 03:18 PM
Sending a Spreadsheet as an Email Attachment vs. Imbedded in Email billbrandi Excel Discussion (Misc queries) 1 April 3rd 08 03:44 AM
sending updates through email Ruth Excel Discussion (Misc queries) 2 May 6th 07 04:21 PM
Email sending colourp Excel Discussion (Misc queries) 1 January 13th 06 01:13 AM


All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"