Hello I am running a Macro to execute a predetermined email with a file attachment when the the excel file opens. I have this automated to open with the task scheduler. I'm a novice at best with this and have run into a issue after adding the Private Sub Workbook_Open() from my understanding this will allow the macro to run when the file opens? When I try and run this through testing I keep getting the error

Argument not Optional.... Its pointing to the line Private Sub Workbook_Open()

I have in "ThisWorkbook" in the project explorer

Private Sub Workbook_Open()

SendMail

End Sub
In the Module I have:

Sub SendMail()

Dim outApp As Object
Dim i As Long

'Check if Outlook is open
On Error Resume Next
Set outApp = GetObject(, "Outlook.Application")
On Error GoTo 0

If outApp Is Nothing Then
MsgBox "Outlook is not open. Open Outlook and try again.", vbExclamation
Exit Sub
End If

'Clear the ticks from column A
Columns("A:A").ClearContents

'The row in which the list of e-mails start
i = 6

While Cells(i, 2).Value <> ""
updateMail Cells(i, 2), Cells(i, 3), Cells(i, 4), Cells(i, 5), _
Cells(i, 6), Cells(i, 7), Cells(i, 8), Cells(i, 9), i
i = i + 1
Wend

Set outApp = Nothing

End Sub

Sub updateMail(ToBox As String, CcBox As String, BccBox As String, _
Subject As String, Message As String, AttachmentList As String, _
AttachmentSeparator As String, Action As String, row As Long)

Dim outApp As Object
Dim outMailItem As Object
Dim i As Integer
Dim attachmentArray() As String

Set outApp = GetObject(, "Outlook.Application")
Set outMailItem = outApp.CreateItem(0)
attachmentArray() = Split(AttachmentList, AttachmentSeparator)

On Error GoTo ErrorFound

'The To, CC and BCC values can send e-mails to multiple recpients
'just ensure the e-mail addresses are separated with a semicolon (
With outMailItem
.To = ToBox
.CC = CcBox
.BCC = BccBox
.Subject = Subject
.Body = Message

For i = LBound(attachmentArray) To UBound(attachmentArray)
.Attachments.Add Trim(attachmentArray(i))
Next

Select Case Action

Case "Display"
.Display
Case "Save"
.Close False
Case "Send"
.Send

End Select

End With


'Display tick or cross
ErrorFound:
If Err.Number = 0 Then
Cells(row, 1) = "ü"
Else
Cells(row, 1) = "û"
End If

CleanUp:
Set outMailItem = Nothing
Set outApp = Nothing

End Sub


Please help