Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / February 2004

Tip: Looking for answers? Try searching our database.

Auto Send via Word VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim Pilcher - 25 Feb 2004 10:55 GMT
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
Eric Legault [MVP - Outlook] - 27 Feb 2004 19:50 GMT
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 = "user@mail.com"
   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.

Signature

Eric Legault - B.A, MCP, MCSD, Outlook MVP
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault

> Hi there,
>
[quoted text clipped - 12 lines]
>
> TIM
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.