SendObject Good but not that Good... (1 Viewer)

H

Hazmataz

Guest
Hi,

I am a newbie to Access and trying to improve the database at work. I have sussed out how to use SendObject to send the data I require BUT the computers are a bit slow (as are the ladies in accounts) and they don't want to use attachments. So can I send the information I want in THE BODY of the EMail (we use Outlook 98) not as an attachment?

We use Access 97

Thanks in advance

H
 

CBragg

VB Dummy
Joined
Oct 21, 2002
Messages
89
Start the code off like this. Please note though that in tools and references, check the Microsoft Outlook reference.

Dim NameSpace As Object
Dim EmailSend As Object
Dim EmailApp As Object

Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(0) ' Mail Item

EmailSend.Subject = "Test Subject"
EmailSend.Body = "ENTER BODY TEXT HERE"
EmailSend.Recipients.Add "[email protected]"
EmailSend.Send

Note: If you want a new line in your code enter ' & vbclrf '


Have fun!!!
 

Rob.Mills

Registered User
Joined
Aug 29, 2002
Messages
871
CBragg,

I am trying to generate an email an insert data. I came across this thread when I was trying to find out how to insert returns into the body message. You say you can use vbClRf to do this?

I've created a dummy function to try and make this work. Have a look, please. When I try to run it it says that 'vbClRf' is not defined. Am I doing this wrong?

Public Function Ret()

Dim str1 As String
Dim str2 As String
Dim strmsg As String

str1 = "This is a test."
str2 = "This is a test."
strmsg = str1 & vbClRf
strmsg = strmsg & str2

Debug.Print strmsg


End Function
 

Fizzio

Chief Torturer
Joined
Feb 21, 2002
Messages
1,885
Should be vbCrLf (Carriage Return, Line Feed - equivalent to Chr(13) & Chr(10))
 

Rob.Mills

Registered User
Joined
Aug 29, 2002
Messages
871
Not sure I'm following you. Do you mean I should make my code this:

strmsg = str1 & vbCrLf (Carriage Return, Line Feed - equivalent to Chr(13) & Chr(10))
 

Fizzio

Chief Torturer
Joined
Feb 21, 2002
Messages
1,885
Nope just
strmsg = str1 & vbCrLf

the bracketed text was just me trying to be a smart arse, explaining why vbCrLf and not vbClRf :D
 

Rob.Mills

Registered User
Joined
Aug 29, 2002
Messages
871
Ahhh. Now I get it. Didn't notice the correction in spelling on the first one.

Thanks
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom