I have some code that jumps here below and just stops at "GeneralEma il" and gives that Argument not Optional Error.
Then I have a module. Wonder if this works with my Office 2013? But I have Access 2007.
Code:
GenerateEmail "anoble@******.com", ContractorName.Value & " Crew Authorization " & cmbContractID.Column(1, cmbContractID.ListIndex) & "-" & AuthNum.Value & " - Starting " & Forms!frmCrewAuthorization!AuthDate.Value, Forms!frmCrewAuthorization!Name.Value & "'s Crew" & vbCrLf & vbCrLf, outFileName, False
Code:
Public Function GenerateEmail(mailTo As String, mailCc As String, mailBcc As String, subject As String, body As String, attachment() As String, autoSend As Boolean)
Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
i = 0
While i <= UBound(attachment)
MyMail.Attachments.Add attachment(i)
i = i + 1
Wend
MyMail.To = mailTo
MyMail.CC = mailCc
MyMail.BCC = mailBcc
MyMail.subject = subject
MyMail.body = body
If autoSend Then
MyMail.Send
Else
MyMail.Display
End If
Set MyMail = Nothing
Set MyOutlook = Nothing
End Function
Comment