Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default "User-defined type not defined" error when trying to send e-mail

Dear all,

I want to send e-mail via a list in a excel document so i try to write a
macro.
In my macro, for outlook i use the code;

Dim OutApp As New Outlook.Application
Dim OutMail As Outlook.MailItem

Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)


But i got an error " user-defined type not defined"

I selected the

Visual basic for applications
Microsoft Excel 11.0 Object library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft DAO 3.6 Object Library.


So i wonder where the problem is and need your help in this situation...

Kind regards,


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default "User-defined type not defined" error when trying to send e-mail

Hi SupperDuck,

You need to add a reference to the Microsoft Outlook xxx Object Library.


---
Regards,
Norman



"SupperDuck" wrote in message
...
Dear all,

I want to send e-mail via a list in a excel document so i try to write a
macro.
In my macro, for outlook i use the code;

Dim OutApp As New Outlook.Application
Dim OutMail As Outlook.MailItem

Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)


But i got an error " user-defined type not defined"

I selected the

Visual basic for applications
Microsoft Excel 11.0 Object library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft DAO 3.6 Object Library.


So i wonder where the problem is and need your help in this situation...

Kind regards,




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default "User-defined type not defined" error when trying to send e-ma

Dear Norman,

Can you please how can i make this?

I do not know to add a reference..

Thanks,

"Norman Jones" wrote:

Hi SupperDuck,

You need to add a reference to the Microsoft Outlook xxx Object Library.


---
Regards,
Norman



"SupperDuck" wrote in message
...
Dear all,

I want to send e-mail via a list in a excel document so i try to write a
macro.
In my macro, for outlook i use the code;

Dim OutApp As New Outlook.Application
Dim OutMail As Outlook.MailItem

Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)


But i got an error " user-defined type not defined"

I selected the

Visual basic for applications
Microsoft Excel 11.0 Object library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft DAO 3.6 Object Library.


So i wonder where the problem is and need your help in this situation...

Kind regards,





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default "User-defined type not defined" error when trying to send e-ma

Ah sorry, adding the same things.

In my first post i forgot to write that there was Microsoft Outlook 11.0
Object library .

There is it but still have problem...

"Norman Jones" wrote:

Hi SupperDuck,

You need to add a reference to the Microsoft Outlook xxx Object Library.


---
Regards,
Norman



"SupperDuck" wrote in message
...
Dear all,

I want to send e-mail via a list in a excel document so i try to write a
macro.
In my macro, for outlook i use the code;

Dim OutApp As New Outlook.Application
Dim OutMail As Outlook.MailItem

Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)


But i got an error " user-defined type not defined"

I selected the

Visual basic for applications
Microsoft Excel 11.0 Object library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft DAO 3.6 Object Library.


So i wonder where the problem is and need your help in this situation...

Kind regards,





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default "User-defined type not defined" error when trying to send e-ma

Are you sure about that (ToolsReferences), as that is exactly the error
that you get if you don't set a reference to the Outlook type library.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"SupperDuck" wrote in message
...
Ah sorry, adding the same things.

In my first post i forgot to write that there was Microsoft Outlook 11.0
Object library .

There is it but still have problem...

"Norman Jones" wrote:

Hi SupperDuck,

You need to add a reference to the Microsoft Outlook xxx Object Library.


---
Regards,
Norman



"SupperDuck" wrote in message
...
Dear all,

I want to send e-mail via a list in a excel document so i try to write

a
macro.
In my macro, for outlook i use the code;

Dim OutApp As New Outlook.Application
Dim OutMail As Outlook.MailItem

Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)


But i got an error " user-defined type not defined"

I selected the

Visual basic for applications
Microsoft Excel 11.0 Object library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft DAO 3.6 Object Library.


So i wonder where the problem is and need your help in this

situation...

Kind regards,









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default "User-defined type not defined" error when trying to send e-ma

Hi SupperDuck,

Providing I had set a reference to the Microsoft Outlook Object Library (In
the VBE, Tools | References), I could not repoduce your error.

Incidentally, but with no bearing on your problem, perhaps your code should
read:

Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem

Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)


---
Regards,
Norman


"SupperDuck" wrote in message
...
Ah sorry, adding the same things.

In my first post i forgot to write that there was Microsoft Outlook 11.0
Object library .

There is it but still have problem...



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default "User-defined type not defined" error when trying to send e-ma

Hello Norman,

Thank your for replies. The problem was, when two Excel files are opened and
i select the Microsoft outlook object library, there is a probability of not
been seen by one of the files.

Is there a way for selecting these libraries, in all excel files including
the new opened ones?

Thanks...


"Norman Jones" wrote:

Hi SupperDuck,

Providing I had set a reference to the Microsoft Outlook Object Library (In
the VBE, Tools | References), I could not repoduce your error.

Incidentally, but with no bearing on your problem, perhaps your code should
read:

Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem

Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)


---
Regards,
Norman


"SupperDuck" wrote in message
...
Ah sorry, adding the same things.

In my first post i forgot to write that there was Microsoft Outlook 11.0
Object library .

There is it but still have problem...




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default "User-defined type not defined" error when trying to send e-ma

Hi SupperDuck,

References are specific to a given workbook.

If you wish to add a reference to all new workbooks, open the workbook
template ( in my case, Book.xlt in my XLSTART folder), add the required
reference(s), save and close the template.


---
Regards,
Norman



"SupperDuck" wrote in message
...
Hello Norman,

Thank your for replies. The problem was, when two Excel files are opened
and
i select the Microsoft outlook object library, there is a probability of
not
been seen by one of the files.

Is there a way for selecting these libraries, in all excel files including
the new opened ones?

Thanks...



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default "User-defined type not defined" error when trying to send e-ma

Why don't you use late binding then. See
http://xldynamic.com/source/xld.EarlyLate.html

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"SupperDuck" wrote in message
...
Hello Norman,

Thank your for replies. The problem was, when two Excel files are opened

and
i select the Microsoft outlook object library, there is a probability of

not
been seen by one of the files.

Is there a way for selecting these libraries, in all excel files including
the new opened ones?

Thanks...


"Norman Jones" wrote:

Hi SupperDuck,

Providing I had set a reference to the Microsoft Outlook Object Library

(In
the VBE, Tools | References), I could not repoduce your error.

Incidentally, but with no bearing on your problem, perhaps your code

should
read:

Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem

Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)


---
Regards,
Norman


"SupperDuck" wrote in message
...
Ah sorry, adding the same things.

In my first post i forgot to write that there was Microsoft Outlook

11.0
Object library .

There is it but still have problem...






  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default "User-defined type not defined" error when trying to send e-ma

Bob,

Is it possible to check if Outlook is actually installed (via VBA) without
running into the Reference error?
--
Trefor


"Bob Phillips" wrote:

Why don't you use late binding then. See
http://xldynamic.com/source/xld.EarlyLate.html

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"SupperDuck" wrote in message
...
Hello Norman,

Thank your for replies. The problem was, when two Excel files are opened

and
i select the Microsoft outlook object library, there is a probability of

not
been seen by one of the files.

Is there a way for selecting these libraries, in all excel files including
the new opened ones?

Thanks...


"Norman Jones" wrote:

Hi SupperDuck,

Providing I had set a reference to the Microsoft Outlook Object Library

(In
the VBE, Tools | References), I could not repoduce your error.

Incidentally, but with no bearing on your problem, perhaps your code

should
read:

Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem

Set myOlApp = New Outlook.Application
Set myItem = myOlApp.CreateItem(olMailItem)


---
Regards,
Norman


"SupperDuck" wrote in message
...
Ah sorry, adding the same things.

In my first post i forgot to write that there was Microsoft Outlook

11.0
Object library .

There is it but still have problem...







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Message "user defined type not defined" LEELK01 Excel Discussion (Misc queries) 2 August 14th 09 07:31 AM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
"User-defined type not defined" vb msg Bruno Gomes Excel Programming 1 May 24th 04 01:01 PM
"Application-defined or object-defined error" while printing excel report chemburkar Excel Programming 0 February 2nd 04 08:33 PM
Why "User-defined type not defined" Shatin Excel Programming 4 February 2nd 04 02:45 PM


All times are GMT +1. The time now is 08:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"