A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Enhance this code



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 1st 07, 08:41 AM posted to microsoft.public.outlook.program_vba
mrbalaje
external usenet poster
 
Posts: 14
Default Enhance this code

I just found the following code to automatically add the attachement and send
to a receipient. It works fine. But What I want is that one email address
should be in the "To" field and 3 other email address to be in the "Bcc"
field.

Also in the body of the mail, I need to add two constant line(Text) and with
my signature. Can someone enhance the below coding for this requirement.


Sub Foobar()
Dim oApp As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oMail As Outlook.MailItem

Set oApp = CreateObject("Outlook.Application")
Set oNS = oApp.GetNameSpace("MAPI")
oNS.Logon

Set oMail = oApp.CreateItem(olMailItem)
With oMail
.Subject = "Cims data"
.Body = "Some body text"
.Attachments.Add "c:\myFolder\File1.xls"
.Attachments.Add "c:\myFolder\File2.xls"
.Recipients.Add "
.Recipients.ResolveAll
.Send
End With
End Sub

  #2  
Old January 1st 07, 03:13 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Enhance this code

Set recip = oMail.Recipients.Add "
recip.Type = olBcc

Repeat as needed.

See http://www.outlookcode.com/codedetail.aspx?id=615 for a code sample to insert the user's default signature. Also note that if you call oMail.Display, the default signature will be added automatically. You can then prefix the Body property value with the text you want to add.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"mrbalaje" wrote in message ...
I just found the following code to automatically add the attachement and send
to a receipient. It works fine. But What I want is that one email address
should be in the "To" field and 3 other email address to be in the "Bcc"
field.

Also in the body of the mail, I need to add two constant line(Text) and with
my signature. Can someone enhance the below coding for this requirement.


Sub Foobar()
Dim oApp As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oMail As Outlook.MailItem

Set oApp = CreateObject("Outlook.Application")
Set oNS = oApp.GetNameSpace("MAPI")
oNS.Logon

Set oMail = oApp.CreateItem(olMailItem)
With oMail
.Subject = "Cims data"
.Body = "Some body text"
.Attachments.Add "c:\myFolder\File1.xls"
.Attachments.Add "c:\myFolder\File2.xls"
.Recipients.Add "
.Recipients.ResolveAll
.Send
End With
End Sub

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
add 1+XXX area code to phone nr in my area code OH Outlook - Using Contacts 3 August 3rd 06 03:45 PM
Enhance Outlook Express with Outlook 2003 capabilities-Calendar jro4200 Outlook - Calandaring 1 June 10th 06 05:35 PM
outlook 2007 enhance email tracking kevin forsythe Outlook - General Queries 1 June 5th 06 01:34 AM
enhance Outlook Calendar so it wil allow copying and pasting apts Bill Outlook - Calandaring 2 March 30th 06 10:05 AM
code : Code : 800cccd2 scotty971fr Outlook Express 1 January 19th 06 11:59 PM


All times are GMT +1. The time now is 06:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.