Hi there
I am trying to send a excel sheet as attachement not using my database but a ‘group’ mail account.
The send by should show “groupmail name, send by my name”.
I did find several scripts in this forum. But either I can use them to send the mail with the expected behaviour regarding the sendby filed or I can attach an Excel (or other) file.
But I did not see a script allowing both.
My gues is that one is using the notes gui (so to say my client) which works for the send by…
…
Sub Routine()
Dim BodyString As String
Dim SubjectString As String
Dim CN, UserName, MailFile As String
Dim workspace As Object
Set workspace = CreateObject(“Notes.NotesUIWorkspace”)
Dim Session As Object
Set Session = CreateObject(“Notes.NotesSession”)
CN = Session.COMMONUSERNAME
Set Session = Nothing
Call workspace.OpenDatabase(“mailserver”, “mailfile.nsf”)
Dim NotesUIDoc As Object
Set NotesUIDoc = workspace.COMPOSEDOCUMENT(“”, “”, “memo”)
EmailAddress = “my.name@host.com”
Call NotesUIDoc.FIELDSETTEXT(“EnterSendTo”, EmailAddress)
SubjectString = “Mail sent with VBA”
Call NotesUIDoc.FIELDSETTEXT(“Subject”, SubjectString)
NotesUIDoc.GOTOFIELD “Body”
NotesUIDoc.InsertText "any text "
NotesUIDoc.Send
NotesUIDoc.Close
'Clean it up
Set NoteUIDoc = Nothing
Set workspace = Nothing
End Sub
while the other works with attachement
…
Sub mail_1()
Set Session = CreateObject("Notes.NotesSession")
Set Maildb = Session.GETDATABASE("mailserver", "mailfile.nsf")
Set MailDoc = Maildb.CREATEDOCUMENT()
MailDoc.APPENDITEMVALUE "SendTo", "my.name@host.com"
MailDoc.APPENDITEMVALUE "Subject", "Testing from VB"
MailDoc.APPENDITEMVALUE "Body", "Testing email from VB with file Attachment"
'Send attachment(s)
Set MailAttachMe = MailDoc.CREATERICHTEXTITEM("Attachment")
Set MailEmbedObj = MailAttachMe.EmbedObject(1454, "", "C:\TEMP\1.TXT", "Attachment")
MailDoc.SEND False
'Clean up
Set MailSession = Nothing
Set MailDatabase = Nothing
Set MailDoc = Nothing
Set MailAttachMe = Nothing
Set MailEmbedObj = Nothing
End Sub
Any Idea how to ‘combine’ those two scripts?
And is there a way to store the send message in a specific folder?
thanks in advance
Laurent