Log in

View Full Version : Reference Library in excel VBA not showing Outlook application



Ajay_2510
04-11-2019, 06:17 AM
I am using windows 10 and Excel 2016

Kenneth Hobs
04-11-2019, 10:33 AM
Welcome to the forum!

Sounds like you have an error in code? In the VBE toolbar, select Reset. I normally put Debug menu Compile on toolbar and compile before a run. If not error, Tools > References will show installed library objects.

Ajay_2510
04-11-2019, 08:53 PM
Please problem is Microsoft outlook is not showing in reference library, I want to add it.

gmayor
04-11-2019, 11:26 PM
You don't need to add it. You can use late binding to Outlook. e.g. If Outlook is installed and working then the following will work.
Better still use the code from 'http://www.rondebruin.nl/win/s1/outlook/openclose.htm to start Outlook


Option Explicit
Global EMAILTARGET As String
Sub SENDEMAILO()
Dim O As Object
Dim OMAIL As Object
EMAILTARGET = "someone@somewhere.com"
Set O = CreateObject("Outlook.Application")
Set OMAIL = O.createitem(0)
OMAIL.To = EMAILTARGET
OMAIL.Subject = "Reminder Save DT"
OMAIL.Send
MsgBox "email sent"
End Sub

Ajay_2510
04-12-2019, 12:09 AM
Hi,
I have tried this code and outlook is also installed but it is saying that cant create object

gmayor
04-12-2019, 01:38 AM
That code should send a simple message. It sounds like Outlook is not properly installed - try repairing Office.