excellearner
New member
- Joined
- Nov 16, 2012
- Messages
- 2
- Reaction score
- 0
- Points
- 0
Hey guys, im working right now on an email client that sends an email depending on a due date based on a cell. Im having difficulties though with retrieving a piece of information from a cell into the subject line (and eventually in the body of the email).
Im using Excel 2007 and Outlook as my email client and have gotten a hold of this code, but its giving me an the error: Compile Error Expected: end of statement.
Any help would be very much appreciated. Btw, this is my first post so i apologize up front for any mistake :/
Im using Excel 2007 and Outlook as my email client and have gotten a hold of this code, but its giving me an the error: Compile Error Expected: end of statement.
Code:
Sub Email()
Dim myOutlook As Object
Dim myMailItem As Object
Dim FName As String
Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItem(olMailItem)
FName = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
With otlNewMail
.To = ""
.CC = ""
.Subject = "ActiveSheet.Range("B1") Homework "
'Here what im trying to do is make sure that if the word chemistry was in cell B1, the subject line would say: chemistry Homework
.Body = ""
.DeferredDeliveryTime = Range("A1")
.Send
End With
Set otlNewMail = Nothing
Set otlApp = Nothing
Set otlAttach = Nothing
Set otlMess = Nothing
Set otlNSpace = Nothing
End Sub
Any help would be very much appreciated. Btw, this is my first post so i apologize up front for any mistake :/