Hello:
SendMessage is a sub (VBA Access 2013)
It turns red and says Compile error: Expected: =
If I remove the second item and just call FileSavePath, the code runs great!
Thanks in advance for any help!
Code:
Private Sub SendMessage(FileSavePath As String, txtempid As String)
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
'Dim txtempname As String
'txtempname = DLookup("name", "dbo_empbasic", "empid = '" & txtEmpID & "' ")
'MsgBox ("txtempname: " & txtempname)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = "sanderson@metromachine.com"
''.cc = ""
''.bcc = ""
.Subject = "Weekly Timecard for "
.HTMLBody = ""
'.HTMLBody = "Attached is the timecard for " & txtempname & ", employee number " & txtempno & " for the week of " & CStr(datPeriodStart) & " through " & CStr(datPeriodEnd) & "."
.Attachments.Add (FileSavePath)
.Send
'.Display 'Used during testing without sending (Comment out .Send if using this line)
End With
End Sub