I found this on another thread. I was looking for the code myself
You can't with SendObject.
If you use Outlook (not Outlook Express), then it can be done like below:
Sub SendAttachedFile(FileNameAndPath$, AttachDescr$, ToAdds$, CCAdds$, BCCAdds$, SubjectLine$, MsgBody$)
Dim myOlApp, MyItem, MyAttachments
Set myOlApp = CreateObject("Outlook.Application"
Set myItem=myOlApp.CreateItem(olMailItem)
With myItem
.To = ToAdds
.CC = CCAdds
.BCC = BCCAdds
.Subject = SubjectLine
.Body = MsgBody
.Attachments.Add FileNameAndPath, olByValue, 1, AttachDescr
.Display 'this will display the result
.Send 'this will place the message immediately to Outbox
End With
set myItem = Nothing
MyOlApp.Close
Set myOlApp = Nothing
End Sub
All procedure arguments should be provided by text boxes on your form.
The procedure can be called from a command button:
Private YourButton_Click()
'whatever code you want to execute before sending the mail
Call SendAttachedFile(Me("FileTextBox", Me("FileDescription", Me("ToAddresses", Me("CCAddresses", Me("BCCAddresses", Me("Subject", Me("Body")
End Sub
HTH
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
Thanks daniel. I have given up on sendobject and have used CDONTS which is fantastic so long as you are using W2000 or NT. I still have a minot problem with it though!. It does not report any errors, even if the internet is not connected. Does anyone have any thoughts on this??
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.