liammoohan
Board Regular
- Joined
- Jan 11, 2008
- Messages
- 72
I am sending an e-mail through outlook using the olmail function. Below is the code I am using.
The issue I am having is that the e-mail will not generate when I add on the part that is highlighted red. It is returning a syntax error. Can anyone please advise how this can be done.
Sub newstartermail()
Request = Range("O24").Value
RequestID = Range("M17").Value
SaveFileCS = Range("B35").Value
SaveFileHR = Range("B36").Value
SaveFileITS = Range("B37").Value
SaveFileCASEFLOW = Range("B38").Value
SaveFileSECURITY = Range("B39").Value
SaveFileGENERAL = Range("B40").Value
Date = Range("F17").Value
Dim olmail As Outlook.MailItem
Dim olapp As New Outlook.Application
Set olmail = olapp.CreateItem(olMailItem)
With olmail
.To = ("email@email.co.uk")
.CC = ("")
.Subject = ("New Starter Request " & Date)
.Body = ("Hello" & Chr(10) & Chr(10) & "Your " & Request & " Request #" & RequestID & " has been raised." & Chr(10) & Chr(10) & "You will receive confirmation once your request has been completed." & Chr(10) & Chr(10) & "For Administration Use Only" & Chr(10) & Chr(10) & "Contact Strategy - " & "<\\Liam\Agent Administration Suite\CS>" & "As file name " & SaveFileCS & ".xls" & Chr(10) & "Human Resources - " & "<\\Liam\Agent Administration Suite\HR>" & "As file name " & SaveFileHR & ".xls" & Chr(10) & "IT Support - " & "<\\Liam\Agent Administration Suite\ITS>" & "As file name " & SaveFileITS & ".xls" & Chr(10) & "Caseflow - " & "<\\Liam\Agent Administration Suite\CASEFLOW>" & "As file name " & SaveFileCASEFLOW & ".xls" & Chr(10) & "Security/Reception - " & "<\\Liam\Agent Administration Suite\SECURITY>" & "As file name " & SaveFileSECURITY & ".xls"
& Chr(10) & Chr(10) & "General Viewing - " & "<\\Liam\Agent Administration Suite\GENERAL>" & "As file name " & SaveFileGENERAL & ".xls")
.Categories = (WeekCom)
.Display
End With
End Sub
The issue I am having is that the e-mail will not generate when I add on the part that is highlighted red. It is returning a syntax error. Can anyone please advise how this can be done.
Sub newstartermail()
Request = Range("O24").Value
RequestID = Range("M17").Value
SaveFileCS = Range("B35").Value
SaveFileHR = Range("B36").Value
SaveFileITS = Range("B37").Value
SaveFileCASEFLOW = Range("B38").Value
SaveFileSECURITY = Range("B39").Value
SaveFileGENERAL = Range("B40").Value
Date = Range("F17").Value
Dim olmail As Outlook.MailItem
Dim olapp As New Outlook.Application
Set olmail = olapp.CreateItem(olMailItem)
With olmail
.To = ("email@email.co.uk")
.CC = ("")
.Subject = ("New Starter Request " & Date)
.Body = ("Hello" & Chr(10) & Chr(10) & "Your " & Request & " Request #" & RequestID & " has been raised." & Chr(10) & Chr(10) & "You will receive confirmation once your request has been completed." & Chr(10) & Chr(10) & "For Administration Use Only" & Chr(10) & Chr(10) & "Contact Strategy - " & "<\\Liam\Agent Administration Suite\CS>" & "As file name " & SaveFileCS & ".xls" & Chr(10) & "Human Resources - " & "<\\Liam\Agent Administration Suite\HR>" & "As file name " & SaveFileHR & ".xls" & Chr(10) & "IT Support - " & "<\\Liam\Agent Administration Suite\ITS>" & "As file name " & SaveFileITS & ".xls" & Chr(10) & "Caseflow - " & "<\\Liam\Agent Administration Suite\CASEFLOW>" & "As file name " & SaveFileCASEFLOW & ".xls" & Chr(10) & "Security/Reception - " & "<\\Liam\Agent Administration Suite\SECURITY>" & "As file name " & SaveFileSECURITY & ".xls"
& Chr(10) & Chr(10) & "General Viewing - " & "<\\Liam\Agent Administration Suite\GENERAL>" & "As file name " & SaveFileGENERAL & ".xls")
.Categories = (WeekCom)
.Display
End With
End Sub