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

Sending mails from Excel 2003 - Outlook signature



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

Hello,

Few months ago i asked ho to insert the outlook 2003 default signature to a
mail sent from excel vba

I was advised to use ".GetInspector" but i still cannot make it work.

I get an error message saying "read only property"


My code is :


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)
MonAppliOutlook = MonMail.GetInspector

With MonMail
.Display '
.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

Thanks for you help

  #2  
Old December 18th 08, 11:58 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Sending mails from Excel 2003 - Outlook signature


GetInspector returns an Inspector object, not an Application object. And
because it returns an object you'd need to use the Set statement. But
because you display the e-mail calling GetInspector shouldn't be necessary
at all.

After you've called Display, the Body property should contain the sig. That
is, calling .Body=Corps will overwerite the Body with the content of Corps.
If you want to preserve the content of Body and insert Corps at the top, you
need to do this:
..Body=Corps & .Body

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Thu, 18 Dec 2008 00:02:05 +0100 schrieb thomas:

Hello,

Few months ago i asked ho to insert the outlook 2003 default signature to

a
mail sent from excel vba

I was advised to use ".GetInspector" but i still cannot make it work.

I get an error message saying "read only property"


My code is :


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)
MonAppliOutlook = MonMail.GetInspector

With MonMail
.Display '
.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

Thanks for you help

  #3  
Old December 18th 08, 08:52 PM posted to microsoft.public.outlook.program_vba
Todd SChram - SCWA
external usenet poster
 
Posts: 1
Default Sending mails from Excel 2003 - Outlook signature

I had the same issue with losing my signature when sending code from Access.
I tried using your suggestion of:

..Body=txtNote & .Body

but did not successfully maintain my default signature in the new email. If
I don't define the .Body property the signature will come up fine.

Thanks.

Todd

"Michael Bauer [MVP - Outlook]" wrote:


GetInspector returns an Inspector object, not an Application object. And
because it returns an object you'd need to use the Set statement. But
because you display the e-mail calling GetInspector shouldn't be necessary
at all.

After you've called Display, the Body property should contain the sig. That
is, calling .Body=Corps will overwerite the Body with the content of Corps.
If you want to preserve the content of Body and insert Corps at the top, you
need to do this:
..Body=Corps & .Body

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Thu, 18 Dec 2008 00:02:05 +0100 schrieb thomas:

Hello,

Few months ago i asked ho to insert the outlook 2003 default signature to

a
mail sent from excel vba

I was advised to use ".GetInspector" but i still cannot make it work.

I get an error message saying "read only property"


My code is :


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)
MonAppliOutlook = MonMail.GetInspector

With MonMail
.Display '
.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

Thanks for you help


  #4  
Old December 20th 08, 12:30 AM posted to microsoft.public.outlook.program_vba
thomas
external usenet poster
 
Posts: 32
Default Re : Sending mails from Excel 2003 - Outlook signature

Thanks

I changed my code and I tried this :

#########################
Private Function EnvoiMail_HTML_New(Adresse As String, Objet As String,
Corps As String, Optional Pièce As String, Optional Cc As String, Optional
Bcc As String, Optional Envoyer_Mail As Boolean)

Dim MonAppliOutlook As Outlook.Application
Dim MonMail As Outlook.MailItem
Dim MaPièce As Outlook.Attachments

Set MonAppliOutlook = CreateObject("Outlook.Application")
Set MonMail = MonAppliOutlook.CreateItem(olMailItem)

On Error Resume Next

With MonMail

If Affichage = "OUI" Then .Display
.To = Adresse
If Not IsNull(Cc) Then .Cc = Cc
If Not IsNull(Bcc) Then .Bcc = Bcc
.BodyFormat = olFormatHTML
.HTMLBody = Corps & .HTMLBody


If Envoyer_Mail = True Then .Send

End With

Set MonAppliOutlook = Nothing
Set MonMail = Nothing

End Function
###########################


but with " .HTMLBody = Corps & .HTMLBody " i only get the signature
in the mail

and if i write " .HTMLBody = Corps " i only get the content of Corps

What did i do wrong?

Many thanks for your help

"Michael Bauer [MVP - Outlook]" a écrit dans le message de
groupe de discussion : ...

GetInspector returns an Inspector object, not an Application object. And
because it returns an object you'd need to use the Set statement. But
because you display the e-mail calling GetInspector shouldn't be necessary
at all.

After you've called Display, the Body property should contain the sig. That
is, calling .Body=Corps will overwerite the Body with the content of Corps.
If you want to preserve the content of Body and insert Corps at the top, you
need to do this:
..Body=Corps & .Body

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Thu, 18 Dec 2008 00:02:05 +0100 schrieb thomas:

Hello,

Few months ago i asked ho to insert the outlook 2003 default signature to

a
mail sent from excel vba

I was advised to use ".GetInspector" but i still cannot make it work.

I get an error message saying "read only property"


My code is :


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)
MonAppliOutlook = MonMail.GetInspector

With MonMail
.Display '
.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

Thanks for you help


  #5  
Old December 21st 08, 08:04 PM posted to microsoft.public.outlook.program_vba
thomas
external usenet poster
 
Posts: 32
Default Re : Sending mails from Excel 2003 - Outlook signature

What do you think?

As said in previous post, whatever i write

..Body=Corps & .Body
or
.HTMLBody = Corps & .HTMLBody

it does not work


Thanks


"thomas" nomail a écrit dans le message de groupe de discussion :
...
Thanks

I changed my code and I tried this :

#########################
Private Function EnvoiMail_HTML_New(Adresse As String, Objet As String,
Corps As String, Optional Pièce As String, Optional Cc As String, Optional
Bcc As String, Optional Envoyer_Mail As Boolean)

Dim MonAppliOutlook As Outlook.Application
Dim MonMail As Outlook.MailItem
Dim MaPièce As Outlook.Attachments

Set MonAppliOutlook = CreateObject("Outlook.Application")
Set MonMail = MonAppliOutlook.CreateItem(olMailItem)

On Error Resume Next

With MonMail

If Affichage = "OUI" Then .Display
.To = Adresse
If Not IsNull(Cc) Then .Cc = Cc
If Not IsNull(Bcc) Then .Bcc = Bcc
.BodyFormat = olFormatHTML
.HTMLBody = Corps & .HTMLBody


If Envoyer_Mail = True Then .Send

End With

Set MonAppliOutlook = Nothing
Set MonMail = Nothing

End Function
###########################


but with " .HTMLBody = Corps & .HTMLBody " i only get the signature
in the mail

and if i write " .HTMLBody = Corps " i only get the content of Corps

What did i do wrong?

Many thanks for your help

"Michael Bauer [MVP - Outlook]" a écrit dans le message de
groupe de discussion : ...

GetInspector returns an Inspector object, not an Application object. And
because it returns an object you'd need to use the Set statement. But
because you display the e-mail calling GetInspector shouldn't be necessary
at all.

After you've called Display, the Body property should contain the sig. That
is, calling .Body=Corps will overwerite the Body with the content of Corps.
If you want to preserve the content of Body and insert Corps at the top, you
need to do this:
..Body=Corps & .Body

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Thu, 18 Dec 2008 00:02:05 +0100 schrieb thomas:

Hello,

Few months ago i asked ho to insert the outlook 2003 default signature to

a
mail sent from excel vba

I was advised to use ".GetInspector" but i still cannot make it work.

I get an error message saying "read only property"


My code is :


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)
MonAppliOutlook = MonMail.GetInspector

With MonMail
.Display '
.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

Thanks for you help


  #6  
Old December 22nd 08, 10:59 AM posted to microsoft.public.outlook.program_vba
thomas
external usenet poster
 
Posts: 32
Default Re : Sending mails from Excel 2003 - Outlook signature

no hint on what i did wrong?

Thanks

"thomas" nomail a écrit dans le message de groupe de discussion :
...
Thanks

I changed my code and I tried this :

#########################
Private Function EnvoiMail_HTML_New(Adresse As String, Objet As String,
Corps As String, Optional Pièce As String, Optional Cc As String, Optional
Bcc As String, Optional Envoyer_Mail As Boolean)

Dim MonAppliOutlook As Outlook.Application
Dim MonMail As Outlook.MailItem
Dim MaPièce As Outlook.Attachments

Set MonAppliOutlook = CreateObject("Outlook.Application")
Set MonMail = MonAppliOutlook.CreateItem(olMailItem)

On Error Resume Next

With MonMail

If Affichage = "OUI" Then .Display
.To = Adresse
If Not IsNull(Cc) Then .Cc = Cc
If Not IsNull(Bcc) Then .Bcc = Bcc
.BodyFormat = olFormatHTML
.HTMLBody = Corps & .HTMLBody


If Envoyer_Mail = True Then .Send

End With

Set MonAppliOutlook = Nothing
Set MonMail = Nothing

End Function
###########################


but with " .HTMLBody = Corps & .HTMLBody " i only get the signature
in the mail

and if i write " .HTMLBody = Corps " i only get the content of Corps

What did i do wrong?

Many thanks for your help

"Michael Bauer [MVP - Outlook]" a écrit dans le message de
groupe de discussion : ...

GetInspector returns an Inspector object, not an Application object. And
because it returns an object you'd need to use the Set statement. But
because you display the e-mail calling GetInspector shouldn't be necessary
at all.

After you've called Display, the Body property should contain the sig. That
is, calling .Body=Corps will overwerite the Body with the content of Corps.
If you want to preserve the content of Body and insert Corps at the top, you
need to do this:
..Body=Corps & .Body

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Thu, 18 Dec 2008 00:02:05 +0100 schrieb thomas:

Hello,

Few months ago i asked ho to insert the outlook 2003 default signature to

a
mail sent from excel vba

I was advised to use ".GetInspector" but i still cannot make it work.

I get an error message saying "read only property"


My code is :


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)
MonAppliOutlook = MonMail.GetInspector

With MonMail
.Display '
.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

Thanks for you help


  #7  
Old December 22nd 08, 09:43 PM posted to microsoft.public.outlook.program_vba
thomas
external usenet poster
 
Posts: 32
Default Re : Sending mails from Excel 2003 - Outlook signature

I found out

with the code .HTMLBody = Corps & .HTMLBody

i get an extra security message http://cjoint.com/data/mwwyjIyRHB.htm

if i answer OUI (YES) th signature is added

This secutity message is not very convenient.

Is there a way to avoid it with a permanent "YES" answer ?

Thanks


"thomas" nomail a écrit dans le message de groupe de discussion :
...
Thanks

I changed my code and I tried this :

#########################
Private Function EnvoiMail_HTML_New(Adresse As String, Objet As String,
Corps As String, Optional Pièce As String, Optional Cc As String, Optional
Bcc As String, Optional Envoyer_Mail As Boolean)

Dim MonAppliOutlook As Outlook.Application
Dim MonMail As Outlook.MailItem
Dim MaPièce As Outlook.Attachments

Set MonAppliOutlook = CreateObject("Outlook.Application")
Set MonMail = MonAppliOutlook.CreateItem(olMailItem)

On Error Resume Next

With MonMail

If Affichage = "OUI" Then .Display
.To = Adresse
If Not IsNull(Cc) Then .Cc = Cc
If Not IsNull(Bcc) Then .Bcc = Bcc
.BodyFormat = olFormatHTML
.HTMLBody = Corps & .HTMLBody


If Envoyer_Mail = True Then .Send

End With

Set MonAppliOutlook = Nothing
Set MonMail = Nothing

End Function
###########################


but with " .HTMLBody = Corps & .HTMLBody " i only get the signature
in the mail

and if i write " .HTMLBody = Corps " i only get the content of Corps

What did i do wrong?

Many thanks for your help

"Michael Bauer [MVP - Outlook]" a écrit dans le message de
groupe de discussion : ...

GetInspector returns an Inspector object, not an Application object. And
because it returns an object you'd need to use the Set statement. But
because you display the e-mail calling GetInspector shouldn't be necessary
at all.

After you've called Display, the Body property should contain the sig. That
is, calling .Body=Corps will overwerite the Body with the content of Corps.
If you want to preserve the content of Body and insert Corps at the top, you
need to do this:
..Body=Corps & .Body

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Thu, 18 Dec 2008 00:02:05 +0100 schrieb thomas:

Hello,

Few months ago i asked ho to insert the outlook 2003 default signature to

a
mail sent from excel vba

I was advised to use ".GetInspector" but i still cannot make it work.

I get an error message saying "read only property"


My code is :


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)
MonAppliOutlook = MonMail.GetInspector

With MonMail
.Display '
.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

Thanks for you 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
Sending e-mails from Outlook 2003 DianneTXCPA Outlook - Installation 1 July 22nd 08 12:01 AM
VBA Outlook 2003 - Sending mails from Excel 2003 thomas Outlook and VBA 2 July 12th 08 09:27 PM
VBA Outlook 2003 - Sending mails from Excel 2003 thomas Outlook - General Queries 2 July 12th 08 10:35 AM
sending mails from excel...but mail body disappearing Jithu Outlook and VBA 0 January 10th 08 01:57 PM
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 09:25 AM.


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.