Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Email from Excel..please help!!

40 views
Skip to first unread message

Bob

unread,
Oct 28, 2003, 10:46:03 AM10/28/03
to
I would like to use Excel VBA to send an email from a
spreadsheet.

The email system we have is Lotus INotes (embedded in our
intranet system)

How do I do this ?.

All the examples I have seen , for sending emails via VBA
assume that OUTLOOK is the default email system.

Please advise.

Many thanks,

Tom Ogilvy

unread,
Oct 28, 2003, 11:07:56 AM10/28/03
to
This was posted by Andy Wiggins: (I haven't used it, so can't say anthing
about it).

LOTUS NOTES:

By Andy Wiggins

Here's a VBA function to mail files using Lotus Notes (watch out for line
wrapping).

''
***************************************************************************
'' Purpose : Send a file as an attachment through Notes
'' Written : 04-Jun-2003 by Andy Wiggins, Byg Software Limited
''
Function SendMail(EMailSendTo As String, EmailSubject As String)
Dim EMailCCTo
Dim EMailBCCTo

On Error GoTo SendMailError

EMailCCTo = "" '' Optional
EMailBCCTo = "" '' Optional

''Establish Connection to Notes
Set objNotesSession = CreateObject("Notes.NotesSession")

''Establish Connection to Mail File
'' .GETDATABASE("SERVER", "FILE")
Set objNotesMailFile = objNotesSession.GETDATABASE("", "")
''Open Mail
objNotesMailFile.OPENMAIL

''Create New Memo
Set objNotesDocument = objNotesMailFile.CREATEDOCUMENT

''Create 'Subject Field'
Set objNotesField = objNotesDocument.APPENDITEMVALUE("Subject",
EmailSubject)

''Create 'Send To' Field
Set objNotesField = objNotesDocument.APPENDITEMVALUE("SendTo",
EMailSendTo)

''Create 'Copy To' Field
Set objNotesField = objNotesDocument.APPENDITEMVALUE("CopyTo",
EMailCCTo)

''Create 'Blind Copy To' Field
Set objNotesField = objNotesDocument.APPENDITEMVALUE("BlindCopyTo",
EMailBCCTo)

''Create 'Body' of memo
Set objNotesField = objNotesDocument.CREATERICHTEXTITEM("Body")

With objNotesField
.APPENDTEXT "This e-mail is generated by an automated process."
.ADDNEWLINE 1
.APPENDTEXT "Please follow established contact procedures should you
have any questions."
.ADDNEWLINE 2
End With

''Attach the file --1454 indicate a file attachment
objNotesField = objNotesField.EMBEDOBJECT(1454, "", EmailSubject)
'' objNotesField = objNotesField.EMBEDOBJECT(1454, "",
ActiveWorkbook.FullName)

''Send the e-mail
objNotesDocument.Send (0)

''Release storage
Set objNotesSession = Nothing
Set objNotesMailFile = Nothing
Set objNotesDocument = Nothing
Set objNotesField = Nothing

''Set return code
SendMail = True

Exit Function

SendMailError:
Dim Msg
Msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext

SendMail = False

End Function


--
Regards,
Tom Ogilvy

"Bob" <anon...@discussions.microsoft.com> wrote in message
news:08b201c39d6a$97ac1fc0$a001...@phx.gbl...

0 new messages