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

VBA Outlook 2003 - Sending mails from Excel 2003



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 12th 08, 10:34 AM posted to microsoft.public.outlook.program_vba
thomas
external usenet poster
 
Posts: 32
Default VBA Outlook 2003 - Sending mails from Excel 2003

Hello,

I use vba to send outlook mails from excel 2003 :

Sub EnvoiMailMéthodeOLE(Adresse As String, Objet As String, Corps As String,
Optional Pièce As String, Optional Cc As String, Optional Bcc As String)
Dim MonAppliOutlook As New Outlook.Application
Dim MonMail As Outlook.MailItem
Dim MaPièce As Outlook.Attachments
Set MonMail = MonAppliOutlook.CreateItem(olMailItem)

With MonMail
.Display ' retirer
le commentaire si vous voulez que le fenêtre Outlook s'affiche
.To = Adresse
If Not IsNull(Cc) Then .Cc = Cc
If Not IsNull(Bcc) Then .Bcc = Bcc
.Subject = Objet
.Body = Corps
If Not IsNull(Pièce) Then
Set MaPièce = .Attachments
MaPièce.Add Pièce, olByValue
End If
.Send
End With

End Sub

I have few problems :

1/ Is there a way to avoid the outlook 2003 confirmation box ?
2/ the confirmation box opens in the left corner of the mail windows. Is it
possible that it be centered?
3/ I would like to format some parts of the body. Is there a way to do it?
4/ Is there a property to add the default signature of outlook 2003 to the
body?

Many thanks for your help




Ads
  #2  
Old July 12th 08, 03:31 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default VBA Outlook 2003 - Sending mails from Excel 2003

1) See http://www.outlookcode.com/article.aspx?ID=52 for your options with
regard to the "object model guard" security prompts.

2) There is no option to control the position of the security prompt dialog.

3) Use the HTMLBody property instead of Body and provide fully tagged HTML
for the content, thus creating a message in HTML format, just like a web
page.

4) No, but if you call MonMail.GetInspector or MonMail.Display, Outlook will
load the signature into the message. Do that before you change Body or
HTMLBody. Because the body will already contain the signature, you will need
to incorporate the existing Body or HTMLBody content (i.e. the signature)
into the new value you want that property to have.

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



"thomas" wrote:

Hello,

I use vba to send outlook mails from excel 2003 :

Sub EnvoiMailMéthodeOLE(Adresse As String, Objet As String, Corps As String,
Optional Pièce As String, Optional Cc As String, Optional Bcc As String)
Dim MonAppliOutlook As New Outlook.Application
Dim MonMail As Outlook.MailItem
Dim MaPièce As Outlook.Attachments
Set MonMail = MonAppliOutlook.CreateItem(olMailItem)

With MonMail
.Display ' retirer
le commentaire si vous voulez que le fenêtre Outlook s'affiche
.To = Adresse
If Not IsNull(Cc) Then .Cc = Cc
If Not IsNull(Bcc) Then .Bcc = Bcc
.Subject = Objet
.Body = Corps
If Not IsNull(Pièce) Then
Set MaPièce = .Attachments
MaPièce.Add Pièce, olByValue
End If
.Send
End With

End Sub

I have few problems :

1/ Is there a way to avoid the outlook 2003 confirmation box ?
2/ the confirmation box opens in the left corner of the mail windows. Is it
possible that it be centered?
3/ I would like to format some parts of the body. Is there a way to do it?
4/ Is there a property to add the default signature of outlook 2003 to the
body?

Many thanks for your help





  #3  
Old July 12th 08, 09:27 PM posted to microsoft.public.outlook.program_vba
thomas
external usenet poster
 
Posts: 32
Default Re : VBA Outlook 2003 - Sending mails from Excel 2003

Thanks

I'll try it tuesday when back to office. Monday is our national holiday


"Sue Mosher [MVP-Outlook]" a écrit dans le message
de groupe de discussion :
...
1) See
http://www.outlookcode.com/article.aspx?ID=52 for your options with
regard to the "object model guard" security prompts.

2) There is no option to control the position of the security prompt dialog.

3) Use the HTMLBody property instead of Body and provide fully tagged HTML
for the content, thus creating a message in HTML format, just like a web
page.

4) No, but if you call MonMail.GetInspector or MonMail.Display, Outlook will
load the signature into the message. Do that before you change Body or
HTMLBody. Because the body will already contain the signature, you will need
to incorporate the existing Body or HTMLBody content (i.e. the signature)
into the new value you want that property to have.

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



"thomas" wrote:

Hello,

I use vba to send outlook mails from excel 2003 :

Sub EnvoiMailMéthodeOLE(Adresse As String, Objet As String, Corps As
String,
Optional Pièce As String, Optional Cc As String, Optional Bcc As String)
Dim MonAppliOutlook As New Outlook.Application
Dim MonMail As Outlook.MailItem
Dim MaPièce As Outlook.Attachments
Set MonMail = MonAppliOutlook.CreateItem(olMailItem)

With MonMail
.Display ' retirer
le commentaire si vous voulez que le fenêtre Outlook s'affiche
.To = Adresse
If Not IsNull(Cc) Then .Cc = Cc
If Not IsNull(Bcc) Then .Bcc = Bcc
.Subject = Objet
.Body = Corps
If Not IsNull(Pièce) Then
Set MaPièce = .Attachments
MaPièce.Add Pièce, olByValue
End If
.Send
End With

End Sub

I have few problems :

1/ Is there a way to avoid the outlook 2003 confirmation box ?
2/ the confirmation box opens in the left corner of the mail windows. Is
it
possible that it be centered?
3/ I would like to format some parts of the body. Is there a way to do it?
4/ Is there a property to add the default signature of outlook 2003 to the
body?

Many thanks for your help





 




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
VBA Outlook 2003 - Sending mails from Excel 2003 thomas Outlook - General Queries 2 July 12th 08 10:35 AM
Do not deliver before mails not sending in Outlook 2003 daffy87 Outlook - Installation 1 March 28th 08 04:30 PM
Outlook 2003 - Problem Sending Mails From Gmail AC BobbyFowler Outlook - Using Forms 2 December 12th 07 06:50 PM
Question about sending e-mails - Outlook 2003 Steve Marshall Outlook and VBA 2 July 5th 06 09:17 AM
Outlook 2003 keep sending mails Joyee Outlook - General Queries 2 May 17th 06 03:43 PM


All times are GMT +1. The time now is 08:27 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.