e-Mail File out of Excel 2003 Macro

M

Marvin

I am getting a type definition error on the first two DIM statements

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
..To = StudenteMail
..CC = ""
..BCC = ""
..Subject = "Class Progress Audio Report for " & Date
Dim strbody As String
strbody = "Outstanding job today. Please keep up the great work " &
StudentName & vbNewLine & vbNewLine & _
"Kind regards" & vbNewLine & _
"Me"
..Attachments.Add ("C:\Cantillation Sounds\InstructorNotes.wav")
..Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
 
T

Tim Lindsley

Try this Marvin.

Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
&tc.

Tim
 
M

Martin Fishlock

A good page on email is

http://www.rondebruin.nl/sendmail.htm

Try changing your code as follows:

'Dim OutApp As Outlook.Application
'Dim OutMail As Outlook.MailItem
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
' OutApp.Session.Logon ' may need or not
Set OutMail = OutApp.CreateItem(0) '(olMailItem)
 
M

Marvin

Works perfect now. Many thanks!!!

Martin Fishlock said:
A good page on email is

http://www.rondebruin.nl/sendmail.htm

Try changing your code as follows:

'Dim OutApp As Outlook.Application
'Dim OutMail As Outlook.MailItem
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
' OutApp.Session.Logon ' may need or not
Set OutMail = OutApp.CreateItem(0) '(olMailItem)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top