Hi ,
I have created a module where it sends automatic email reminders to designated people via Outlook. While running the code, I got first the compile error as User type not defined. So for that I went to Tools>References> and Ticked on the MS Outlook Object Library 14. But still again I after running the code again, it gives the Complie error now
Block If without End If
Please help me to fix it.
I am including few lines of the module
Function GenerateEmail(MySQL As String)
' On Error GoTo Exit_Function:
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
Dim rs As Recordset
Set rs= CurrentDb.OpenRecordset(MySQL)
If rs.RecordCount> 0 Then
rs.MoveFirst
Do Until rs.EOF
If IsNull(rs!Email) Then
rs.MoveNext
Else
'Set oOutlook = GetObject(,"Outlook.application")
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.CreateItem(olMailItem)
With oEmailItem
.To = rs!Email
.Subject = "Task due in...
Thanks