1

I have an Excel file with a VBA code to send a outlook mail according specific excel cell contents, but it gave me a Compile error.

The first few lines of the code are copied in directly from the VBE as:

Dim OutApp As Object
Dim OutMail As Object
Dim impname As String
Dim leadname As String
Dim subje As String
Dim ns As Namespace
Dim myOlSel As Outlook.Selection

The error showing at "Dim ns As Namespace"

This code was working fine till last three day's but now it is showing an error msg. I have tried to clear Missing libraries form "Tools | References" but still I am facing the issue.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Achyut Deore
  • 25
  • 2
  • 6
  • Since `Namespace` is not a native VBA type, you will need a reference to early bind it. What references _do_ you have in Tools|References? – chris neilsen Oct 19 '16 at 03:51
  • 2
    Have you added reference to Microsoft Outlook Object Library ? It will be something like Microsoft Outlook xx.x Object Library – Mukul Varshney Oct 19 '16 at 03:55
  • Possible duplicate of [User Defined Type Not Defined - Excel Macros](http://stackoverflow.com/questions/24261557/user-defined-type-not-defined-excel-macros) – Zev Spitz Dec 29 '16 at 07:59
  • 1
    Possible duplicate of [User-defined type not defined for AppointmentItem in Excel](https://stackoverflow.com/questions/3645470/user-defined-type-not-defined-for-appointmentitem-in-excel) – niton Oct 31 '17 at 10:16

1 Answers1

-1

From the error message shown, it is possible that you are missing any references or imported libraries on your code or maybe the excel file extension that you are working with does not support macros

GNMercado
  • 433
  • 5
  • 9