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]
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]