MisterProzilla
Active Member
- Joined
- Nov 12, 2015
- Messages
- 264
Hi there,
This one's probably as basic as it gets for some users, but I've tried a bunch of how-to guides and can't get it working.
Please see code below; the comment lines should explain what I'm trying to do. The problem is it's coming up with an error "Compile error: Assignment to constant not permitted" and it's highlighting the 'olMail' text that I've put in bold below. No idea what that means, unfortunately
Any help appreciated!
This one's probably as basic as it gets for some users, but I've tried a bunch of how-to guides and can't get it working.
Please see code below; the comment lines should explain what I'm trying to do. The problem is it's coming up with an error "Compile error: Assignment to constant not permitted" and it's highlighting the 'olMail' text that I've put in bold below. No idea what that means, unfortunately

Any help appreciated!
Code:
Sub Remind_Manager()
' Button to email reminder of upcoming review meeting
' Administrator clicks in the staff's row, then clicks button to send a reminder
' column L contains the line manager's name, retrieved by a VLOOKUP
strEmailTo = "L" & ActiveCell.Row
Set olApp = New Outlook.Application
Dim olNs As Outlook.Namespace
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon
Set [B]olMail[/B] = olApp.CreateItem(olMailItem)
olMail.To = strEmailTo
olMail.Subject = "Test"
olMail.Body = vbCrLf & "Hi, this is a test" & strEmailTo & vbCrLf & vbCrLf & "Regards"
'
End Sub