Auto Send via Word VBA

  • Thread starter Thread starter Tim Pilcher
  • Start date Start date
T

Tim Pilcher

Hi there,

Is there anyone out there that can help me with the
following problem.

I have a VBA form in word in which i want the user to type
in a mobile number and the text message itself. When the
user clicks the Send button it populates the TO: field
with the number and populates the body with the text. It
must send the message in the background.

Is there any way I can do this.

Regards

TIM
 
If you just want to create an e-mail, populate the To: field and message
body, and then send it, all you need to do is this:

Sub SendMessage()
Dim objOL As Outlook.Application
Dim objMessage As Outlook.MailItem

Set objOL = New Outlook.Application
Set objMessage = objOL.CreateItem(olMailItem)
objMessage.To = "(e-mail address removed)"
objMessage.Subject = "My subject"
objMessage.Body = "My body"
objMessage.Send
Set objMessage = Nothing
Set objOL = Nothing
End Sub

Note that Outlook versions greater than 2000 or with the E-mail Security
Update will get prompted to send the message. See
http://www.slipstick.com/outlook/esecup.htm#autosec for more info.
 
Back
Top