Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour.
Essaie le code suivant. Il faut exécuter la macro "Envoi" après avoir
modifié les champs.
La session Notes doit être ouverte et active.
Sub Envoi()
Dim Sujet As String, Corps As String, Desti As String
Dim CC As String, c As Range, PJ As String
Sujet = "Sujet du message"
Corps = "Corps du message"
CC = ""
Desti = ""
PJ = "c:tempsPieceJointe.xls"
SendNotesMail Sujet, Corps, Desti, CC, PJ
End Sub
Public Sub SendNotesMail(Sujet, Corps, Desti, CC, PJ)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim Corps_Msg As String ' text du courriel
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Next line only works with 5.x and above. Replace password with your
password
' Session.Initialize ("password" )
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string or using above password you can use other
mailboxes.
''MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) -
InStr(1, UserName, " "))) & ".nsf"
''UserName = Session.UserName
''SearchString = Recipient
''SearchChar = "@"
''MyPos = InStr(1, SearchString, SearchChar, vbTextCompare)
''Destinataire = Left(SearchString, MyPos - 1)
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", "")
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Desti
MailDoc.Subject = Sujet
MailDoc.copyto = CC
'MailDoc.Body = Corps
Set MailCorps = MailDoc.CREATERICHTEXTITEM("Body")
With MailCorps
.ADDNEWLINE 1
.APPENDTEXT Corps
.ADDNEWLINE 2
End With
MailDoc.SAVEMESSAGEONSEND = True
'Set up the embedded object and attachment and attach it
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
'AttachME.AppendText "toto"
Call AttachME.EMBEDOBJECT(1454, "", PJ, "Attachment")
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items
folder
MailDoc.Send 0
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub
Cordialement.
Daniel
"Lolo" a écrit dans le message de news:Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour.
Essaie le code suivant. Il faut exécuter la macro "Envoi" après avoir
modifié les champs.
La session Notes doit être ouverte et active.
Sub Envoi()
Dim Sujet As String, Corps As String, Desti As String
Dim CC As String, c As Range, PJ As String
Sujet = "Sujet du message"
Corps = "Corps du message"
CC = ""
Desti = "moi@cretin.fr"
PJ = "c:tempsPieceJointe.xls"
SendNotesMail Sujet, Corps, Desti, CC, PJ
End Sub
Public Sub SendNotesMail(Sujet, Corps, Desti, CC, PJ)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim Corps_Msg As String ' text du courriel
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Next line only works with 5.x and above. Replace password with your
password
' Session.Initialize ("password" )
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string or using above password you can use other
mailboxes.
''MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) -
InStr(1, UserName, " "))) & ".nsf"
''UserName = Session.UserName
''SearchString = Recipient
''SearchChar = "@"
''MyPos = InStr(1, SearchString, SearchChar, vbTextCompare)
''Destinataire = Left(SearchString, MyPos - 1)
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", "")
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Desti
MailDoc.Subject = Sujet
MailDoc.copyto = CC
'MailDoc.Body = Corps
Set MailCorps = MailDoc.CREATERICHTEXTITEM("Body")
With MailCorps
.ADDNEWLINE 1
.APPENDTEXT Corps
.ADDNEWLINE 2
End With
MailDoc.SAVEMESSAGEONSEND = True
'Set up the embedded object and attachment and attach it
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
'AttachME.AppendText "toto"
Call AttachME.EMBEDOBJECT(1454, "", PJ, "Attachment")
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items
folder
MailDoc.Send 0
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub
Cordialement.
Daniel
"Lolo" <Lolo@discussions.microsoft.com> a écrit dans le message de news:
E26F5B52-41E3-4AB5-BEB1-2A0F1200690E@microsoft.com...
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour.
Essaie le code suivant. Il faut exécuter la macro "Envoi" après avoir
modifié les champs.
La session Notes doit être ouverte et active.
Sub Envoi()
Dim Sujet As String, Corps As String, Desti As String
Dim CC As String, c As Range, PJ As String
Sujet = "Sujet du message"
Corps = "Corps du message"
CC = ""
Desti = ""
PJ = "c:tempsPieceJointe.xls"
SendNotesMail Sujet, Corps, Desti, CC, PJ
End Sub
Public Sub SendNotesMail(Sujet, Corps, Desti, CC, PJ)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim Corps_Msg As String ' text du courriel
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Next line only works with 5.x and above. Replace password with your
password
' Session.Initialize ("password" )
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string or using above password you can use other
mailboxes.
''MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) -
InStr(1, UserName, " "))) & ".nsf"
''UserName = Session.UserName
''SearchString = Recipient
''SearchChar = "@"
''MyPos = InStr(1, SearchString, SearchChar, vbTextCompare)
''Destinataire = Left(SearchString, MyPos - 1)
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", "")
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Desti
MailDoc.Subject = Sujet
MailDoc.copyto = CC
'MailDoc.Body = Corps
Set MailCorps = MailDoc.CREATERICHTEXTITEM("Body")
With MailCorps
.ADDNEWLINE 1
.APPENDTEXT Corps
.ADDNEWLINE 2
End With
MailDoc.SAVEMESSAGEONSEND = True
'Set up the embedded object and attachment and attach it
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
'AttachME.AppendText "toto"
Call AttachME.EMBEDOBJECT(1454, "", PJ, "Attachment")
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items
folder
MailDoc.Send 0
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub
Cordialement.
Daniel
"Lolo" a écrit dans le message de news:Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Re-bonjour,
Ne pas oublier d'ajouter la référence
Lotus Domino Objects
"Lolo" a écrit dans le message de news:Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Re-bonjour,
Ne pas oublier d'ajouter la référence
Lotus Domino Objects
"Lolo" <Lolo@discussions.microsoft.com> a écrit dans le message de news:
E26F5B52-41E3-4AB5-BEB1-2A0F1200690E@microsoft.com...
Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.
Re-bonjour,
Ne pas oublier d'ajouter la référence
Lotus Domino Objects
"Lolo" a écrit dans le message de news:Bonjour
Une question en vba Excel que mon pauvre cerveau n'arrive à résoudre.
Je souhaite envoyer un E-Mail depuis une application Excel (2002 SP3)
développé en VBA. J'utilise actveworkbook.sendmail mais cela ne fonctionne
pas.