Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Outlook > VBA Outlook
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 13/05/2008, 16h44   #1
Invité de passage
 
Inscription : mai 2008
Messages : 2
Détails du profil
Informations forums :
Inscription : mai 2008
Messages : 2
Points : 0
Points : 0
Par défaut Propriété "From" à l'envois d'email via VBA Excel

Bonjour à tous

Voila.. je suis en peu embêter...

Avant j'utilisais cette macro mais malheureusement, elle n'envoyais pas le email à tous les cous... sans avertissement...

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
With Application
    .EnableEvents = False
    .ScreenUpdating = False
End With
 
    Set rng = Nothing
    Set rng = ActiveSheet.UsedRange
 
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
 
    With iMsg
        Set .Configuration = iConf
        .To = "abc1@def.com"
        .CC = "abc2@def.com"
        .From = """DIRECTION"" <info@def.com>"
        .Subject = "OBJECTIF VENTE ABC1 - " & Now
        .htmlBody = RangetoHTML(rng)
        .Fields("urn:schemas:mailheader:X-Priority") = 1
        .Send
    End With
Mais maintenent j'utilise une autre manière qui envoie le email a tous les cous... mais la propriété .From ne fonctionne pas... Il utilise ma session actuel

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
    Dim MonAppliOutlook As New Outlook.Application
    Dim MonMail As Outlook.MailItem
    Set MonMail = MonAppliOutlook.CreateItem(olMailItem)
    With MonMail
        '.Display ' retirer le commentaire si vous voulez que le fenêtre Outlook s'affiche
        .To = "abc1@def.com"
        '.Cc = "abc2@def.com"
        .From = """DIRECTION"" <info@chemineelining.com>"
        .Subject = "OBJECTIF VENTE ABC1 - " & Now
        .HTMLBody = RangetoHTML(rng)
        .Fields("urn:schemas:mailheader:X-Priority") = 1
        .Send
    End With
Si vous connaisser la bonne propriété sa serais apprécier... Malheureusement SenderName est en lecture seul.

J'utilise Windows XP Pro avec la suite Office Pro 2002

Merci beaucoup!
chemineelining est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 13/05/2008, 18h04   #2
Rédacteur/Modérateur
 
Avatar de Dolphy35
 
Homme Morgan BILLY
Technicien de Production
Inscription : octobre 2004
Messages : 4 106
Détails du profil
Informations personnelles :
Nom : Homme Morgan BILLY
Âge : 33
Localisation : France, Ille et Vilaine (Bretagne)

Informations professionnelles :
Activité : Technicien de Production
Secteur : Industrie

Informations forums :
Inscription : octobre 2004
Messages : 4 106
Points : 8 745
Points : 8 745
Salut et bienvenue sur le Forum Outlook,

essaye ceci :

Code :
.From = "info@chemineelining.com"

Dolphy
__________________
Personnaliser la vue Backstage d'Access 2010
Découvrez avec nous Office 2010
Je ne réponds pas aux questions techniques par MP
Dolphy35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 13/05/2008, 18h56   #3
Invité de passage
 
Inscription : mai 2008
Messages : 2
Détails du profil
Informations forums :
Inscription : mai 2008
Messages : 2
Points : 0
Points : 0
Citation:
Envoyé par Dolphy35 Voir le message
Salut et bienvenue sur le Forum Outlook,

essaye ceci :

Code :
.From = "info@chemineelining.com"

Dolphy
Désolé... ça ne fonctionne pas plus !

C'est dommage que CDO fonctionne pas toujours et je comprend pas pourquoi... et il ne m'avertis pas quand ça n'a pas fonctionner...
chemineelining est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/05/2008, 09h56   #4
Membre chevronné
 
Avatar de Oliv-
 
Inscription : mars 2006
Messages : 643
Détails du profil
Informations personnelles :
Âge : 41

Informations forums :
Inscription : mars 2006
Messages : 643
Points : 699
Points : 699
Bonjour,
Il me semble que avec outlook la propriété FROM n'existe pas !

Essaye SentOnBehalfOfName= "mon nom"

Sinon avec CDO il n'y a pas de raison que cela ne fonctionne pas, à mon avis il te manque le paramétrage de iConf

voici un exemple

Set .Configuration = GetSMTPServerConfig()


Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Function GetSMTPServerConfig() As Object
 
    Dim Cdo_Config As New CDO.Configuration
    Dim Cdo_Fields As Object
    Set Cdo_Fields = Cdo_Config.Fields
 
    With Cdo_Fields
        .item(cdoSendUsingMethod) = cdoSendUsingPort
'à decommenter pour forcer l'utilisation
        '.Item(cdoSMTPServer) = "smtp.tonprovider.fr"
        '.Item(cdoSMTPServerPort) = 25
        .Update
    End With
 
    Set GetSMTPServerConfig = Cdo_Config
    Set Cdo_Config = Nothing
    Set Cdo_Fields = Nothing
 
End Function
Oliv- est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 01h03.


 
 
 
 
Partenaires

Hébergement Web