VB/E.mail with outlook...Ivan (again)/Jerrid


Posted by Ian on August 31, 2001 7:37 AM

I have asked this question further down and got an answer, Ivan said it would do fine the answer was posted by Jerrid (he did say it wasn't tested by him). it didn't work for me

here's the code I have to date (it's doctored from someone else's)

Private Sub CommandButton1_Click()

Dim ObjOutLook As Object 'Outlook.Application
Dim ObjMailitem As Object 'Outlook.Mailitem
Dim SendAnEmail As Boolean

ThisWorkbook.Save

Set ObjOutLook = CreateObject("Outlook.Application")
Set ObjMailitem = OLook.createitem(0)
ObjMailitem.to = "ian.mcconnell@sitel.co.uk"
ObjMailitem.Subject = "Here's the figure's for the week commencing " _
& Cells(4, 2).Value
ObjMailitem.body = "hello"

''''''''''''''''''''

ObjMailitem.send

End Sub

where I've put ''''''''''' where I'd like to put something like (Also something that works :)):

ObjMailitem.Attachments = the current workbook from it's current location

I know not the first or second bit:

ObjMailitem.Attachments

or

how to send itself

thanks

Ian

Posted by Tom Urtis on August 31, 2001 9:15 AM

Re: here's one way to do it:

Ian,

Try adding this in your code below your line "Set ObjMailitem = OLook.createitem(0)":

fName = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name

Then, add this after your line "ObjMailitem.body = "hello" "

.Attachments.Add fName


Then add this after your With structure:

Set otlAttach = Nothing

HTH

Tom Urtis

Posted by Ivan F Moala on August 31, 2001 6:57 PM

Re: here's one way to do it: Thanks Tom

Posted by Ian on September 02, 2001 4:21 AM

Thanks Tom I'll give it go on Monday



Posted by Ian on September 02, 2001 4:21 AM

Thanks Tom I'll give it go on Monday