PDA

View Full Version : Have a form where I need the contents to be displayed in an email body



antivenom
12-22-2005, 01:30 PM
I have a form that needs to have the contents displayed in an email. I can get text to display but if I use a drop down box the resulting text will not appear. I need help, and I am such a newbie that most terminology is lost on me.

I have the form attached and just need a bit of help (OK) a lot of help.

I really have learned quite a bit from this forum but am still too new to just dive in.

Thanks in advance to all of you who can help and will take the few minutes to fix my dilemma.

matthewspatrick
12-29-2005, 12:35 PM
Generally, you could use code like this in a button's OnClick event sub:


Dim olApp As Object
Dim olMsg As Object
Dim MsgBody As String

Set olApp = CreateObject("Outlook.Application")
Set olMsg = olApp.CreateItem(0)

MsgBody = "Something1: " & Me!Control1
MsgBody = MsgBody & Chr(10) & "Something2: " & Me!Control2
MsgBody = MsgBody & Chr(10) & "Something3: " & Me!Control3
'you get the idea

With olMsg
.Subject = "Your subject"
.To = "Yourrecipient@yourdomain.com"
.Body = MsgBody
.Send
End With

Set olMsg = Nothing
Set olApp = Nothing


Of course, if you are using Office XP or 2003, or 2000 with the latest service pack, you may get a security warning that another app is trying to automate Outlook. There are ways around that:devil: