Auto Email

RichB

New member
Local time
Today, 14:10
Joined
May 15, 2001
Messages
96
Can someone please look at this and help me as it does not work? It stops right away at the "Dim olApp As Outlook.Application". It tells me "user-defined type not defined". I have searched the forums and could not find a solution.

Thanks,
RichB



Private Sub Command154_Click()
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application

'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.To = "Forms!FrmPersonal!Email"
.BCC = Forms!FrmPersonal!rateremail & Forms!FrmPersonal!rrateremail
.Subject = "AUTO EMAIL REMINDER"
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>Blah, Blah, Blah</BODY></HTML>"
.Display
End With

End Sub
 
It relates to the References - I found I had to have the Reference to Microsoft Outlook 10.0 Object Library ticked.

In your VB window - go to Tools, References, Browse for the Reference for Outlook and tick and close the References form.
 
Yep, that's it. Thanks. I should have known that!!:o
 

Users who are viewing this thread

Back
Top Bottom