If you are running from Excel itself, as KeepItCool said, you don't need the
xlapp bit.
Dim wkbk as Workbook
set wkbk = workbooks.Open("C:\MyFolder\Test.xls")
wkbk.SendMail ", _
Subject:="files for the day"
wkbk.Close SaveChanges:=False
set wkbk = nothing
some other sources of information:
Ron de Bruin
http://www.rondebruin.nl/sendmail.htm
http://msdn.microsoft.com/library/en...odc_xlmail.asp
Dick Kuselika
www.dicks-clicks.com
Tim Zych
www.rubbershoe.com/olmail.htm
--
Regards,
Tom Ogilvy
"Tom Ogilvy" wrote in message
...
You can try this:
Dim xlapp As Object
Dim wkbk as Object
Set xlapp = CreateObject("Excel.Application")
xlApp.Visible = True
set wkbk = xlapp.Workbooks.Open("C:\myfolder\test.xls")
wkbk.SendMail _
", Subject:="files for the day"
wkbk.Close SaveChanges:=False
set wkbk = nothing
xlApp.Quit
set xlApp = Nothing
--
Regards,
Tom Ogilvy
"Bobsa" wrote in message
om...
I'm using the following code to try and send a file as an attachment
from an Excel 2002 VBA macro. but I cannot get this to work in any
way.. any ideas
Dim xlapp As Object
Set xlapp = CreateObject("Excel.Application")
With xlapp
.Visible = True
.Workbooks.Open ("test.xls")
.Workbooks("test.xls").SendMail
", Subject:="files for the day"
End With
I have to fire up and instance of excel, I've tried with and without
opening it but just get Subscript out of range... and I've tried lots
of different way..
I'll use anyhting to send it ... tried .sendmail butthis throws up a
different but equally infuriating set of errors....
help
Rob