Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Email Workbook

You don't have a reference to Outlook

In the VBA IDE goto TOOLS ---- References and make sure Outlook is selected

HTH
-Merk


11/25/03 04:30PM

I'm trying to get code that will email the active workbook
to an email address that is located in a cell A1. I found
the code below, but I get the following message whenever I
try to use it: "Compile Error: User-defined type not
defined". Any suggestions? Thanks! Matt

Sub Send_Msg()
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = Range ("A1")
.Subject = "Test"
.Body = "Test"
.Display
End With
Set objMail = Nothing
Set objOL = Nothing
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Email Workbook

I'm trying to get code that will email the active workbook
to an email address that is located in a cell A1. I found
the code below, but I get the following message whenever I
try to use it: "Compile Error: User-defined type not
defined". Any suggestions? Thanks! Matt

Sub Send_Msg()
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = Range ("A1")
.Subject = "Test"
.Body = "Test"
.Display
End With
Set objMail = Nothing
Set objOL = Nothing
End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Email Workbook

U need to make sure you have referenced the Microsoft
Outlook library.
Goto ToolsReferences.
Then select Microsoft Outlook (9.0/10) Object Library.

That should get your code working.
Cheers.
Russ.

-----Original Message-----
I'm trying to get code that will email the active

workbook
to an email address that is located in a cell A1. I

found
the code below, but I get the following message whenever

I
try to use it: "Compile Error: User-defined type not
defined". Any suggestions? Thanks! Matt

Sub Send_Msg()
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = Range ("A1")
.Subject = "Test"
.Body = "Test"
.Display
End With
Set objMail = Nothing
Set objOL = Nothing
End Sub
.

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
protect a workbook to email Shazza Excel Discussion (Misc queries) 2 September 12th 07 05:53 AM
How to email 1 sheet in a workbook? Hosh New Users to Excel 2 April 5th 07 01:42 PM
Email a worksheet vs workbook Cheri Excel Discussion (Misc queries) 2 February 15th 06 05:20 PM
cant email workbook thru excel jaredwetmore Excel Discussion (Misc queries) 2 September 16th 05 06:37 PM
how to email one sheet only of a workbook Raven Excel Discussion (Misc queries) 2 May 14th 05 03:39 PM


All times are GMT +1. The time now is 11:20 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"