Confused_UK
Board Regular
- Joined
- Dec 19, 2015
- Messages
- 56
Hi all
I'm looking for some guidance. I have done a script to send an email notification when a database is updated.
"EmailTo" is a named range of email addresses
"EmailSubject" is a named cell with the subject header
"EmailBody" is a named cell with the body of the email
However, when I run it, I get a type mismatch run time error 13 against the line
What have I missed? Any help would be greatly appreciated.
I'm looking for some guidance. I have done a script to send an email notification when a database is updated.
"EmailTo" is a named range of email addresses
"EmailSubject" is a named cell with the subject header
"EmailBody" is a named cell with the body of the email
Code:
Sub EmailNotification()
Dim Mailaddress As String
Dim olApp As Object
If Range("EmailTo").Value <> "" Then
Set olApp = CreateObject("Outlook.Application")
With olApp.CreateItem(0)
.To = Range("EmailTo").Value
.Subject = Range("EmailSubject").Text
.Body = Range("EmailBody").Text
.Display
.Send
End With
End If
End Sub
However, when I run it, I get a type mismatch run time error 13 against the line
Code:
If Range("EmailTo").Value <> "" Then
What have I missed? Any help would be greatly appreciated.