Email with Lotus Notes code!

spowers21

Registered User.
Local time
Today, 07:57
Joined
Mar 28, 2002
Messages
49
I have found some code on the interenet ( I can't rember where) that allows you to send an email with an attachment through Lotus Notes. It works great when you block the line for the attachment. I would like to use this to attach a Word doc to my email. When I try to run it I get an error that the file I am trying to attach could not be found. Can someone look at this code and give me some hints. Thanks!

Please excuse the field names.
Dim s As Object
Dim db As Object
Dim doc As Object
Dim rtItem As Object
Dim Server As String, Database As String
Dim strError As String

'startup Lotus notes and get object handle
Set s = CreateObject("Notes.notesSession")
Server = s.GETENVIRONMENTSTRING("MailServer", True)
Database = s.GETENVIRONMENTSTRING("MailFile", True)
Set db = s.GETDATABASE(Server, Database)

On Error GoTo ErrorLogon
'see if user is logged on
Set doc = db.CREATEDOCUMENT
On Error GoTo 0

doc.Form = "Memo"
doc.importance = "1" '(Where 1=Urgent, 2= Normal, 3= FYI)

'Send an e-mail to
doc.SENDTO = (Me![Vendor1Email])
doc.RETURNRECEIPT = "1"
doc.Subject = "Bid Request"

Set rtItem = doc.CREATERICHTEXTITEM("Body")
Call rtItem.APPENDTEXT(Me![Vendor1])
Call rtItem.ADDNEWLINE(2)
Call rtItem.APPENDTEXT("Dear " & (Me![Vendor1Contact]))
Call rtItem.ADDNEWLINE(1)
Call rtItem.APPENDTEXT("Please provide pricing on the item listed below by TIME and DATE. If you should have any questions please feel free to give me a call. My phone number is 706-644-6375 or you may contact me by e-mail at spowers@tsys.com. Thanks in advance for you help on this project. ")


Call rtItem.EMBEDOBJECT(1454, "", "C:\scott\BidRequest")
Call doc.send(False)


Set doc = Nothing
Set db = Nothing
Set s = Nothing
Set rtItem = Nothing

ErrorLogon:
If Err.Number = 7063 Then
MsgBox " You must first logon to Lotus Notes"
Set doc = Nothing
Set db = Nothing
Set s = Nothing
Set rtItem = Nothing
End If

Me![Vendor1BidSent] = -1
Me![Vendor1DateSent] = Now
Refresh
MsgBox " Your email has been sent to " & Me![Vendor1Contact]
 
You are missing the file extension

Call rtItem.EMBEDOBJECT(1454, "", "C:\scott\BidRequest")


Should be
Call rtItem.EMBEDOBJECT(1454, "", "C:\scott\BidRequest.doc")

Jerid
 
That did it!!! Thanks, I knew it had to something simple. I appreciate your time to help me with this problem!
 
Can't Create Object

I attempted to run the above code to send mail through lotus and I am getting a run time error where s is set equal to 'CreateObject("Notes.notesSession")'.

It is telling me that the ActiveX component can't create object.

It would be really helpful to be able to use access to interface with Lotus. Any help would be appreciated.


Kris
 

Users who are viewing this thread

Back
Top Bottom