473,405 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

creating email attachments

Hello,

I got some code from http://www.fabalou.com/VBandVBA/lotusnotesmail.asp to
send emails atomatically from access. It works but does not attach anything
to the email

I am trying to email the report "RP_NC Form" when I clic a button.. What s
wrong in the following code?:

Private Sub Command231_Click()
'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 MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment snapshotfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim recip(25) As Variant
recip(0) = "em****@email.com"
recip(1) = "em****@email.com"
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'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
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr
(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", MailDbName)
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 = recip
MailDoc.Subject = Subject
MailDoc.Body = BodyText
MailDoc.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("RP_NC Form")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "RP_NC Form")

End If
'Send the document
MailDoc.SEND 0, recip
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200601/1
Jan 3 '06 #1
1 1673
Red
Here's a GREAT link for email in access.... it's old school... thank
god for backwards compatibility...

http://www.granite.ab.ca/access/email.htm

I had to use this to find information on using groupwise email in
access 97... crazy stuff...

Jan 3 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Paul Schmidt | last post by:
Dear list: I am new to python, and I am trying to figure out the short answer on something. I want to open a POP3 mailbox, read the enclosed mail using the POP3 module, , and then process it...
3
by: LutherRevisited | last post by:
Is there a way I can put a message together without having to download any attachments there may be at the same time. I'm not having any problems dealing with attachments, but the way I'm doing...
5
by: morphex | last post by:
Hi, I have an email that's in the utf-8 encoding, and I'm getting this error message when I try to send it using smtplib: * Module smtplib, line 688, in sendmail * Module smtplib, line 485,...
1
by: Patriot | last post by:
A developer that left us had created a macro in VB6 that allowed a user to click on a button, which I also need help with, that would copy any attachments for a particular email to a network share....
7
by: Michael Williams | last post by:
Hi All, I'm looking for a quality Python XML implementation. All of the DOM and SAX implementations I've come across so far are rather convoluted. Are there any quality implementations that...
1
by: mike11d11 | last post by:
If someone could help me, I need to be able to send attachments from my access database that I have created. This database runs queries then generates a report off the queries from underlying...
10
by: OdAwG | last post by:
Hello All, Is it possible to send an email from Access? I found a Microsoft article on how to do this but I keep getting an error "RUNTIME ERROR 438" -- Object doesn't support this property or...
9
by: RedMoosh | last post by:
is it possible to rn a client side vbscript to send messages using cdo.message and cdo.configuration? what are the requirements to do this? my wks are xp and 2000 and all have cdosys.dll...
2
by: oyster | last post by:
I find that the existing email moudle is some hard for me to understand, especially the part of how to set the CC, BCC and attach the files. Is there any more easy one like this p-code? import...
1
by: rmarek | last post by:
I need to create an Outlook email from within Access that adds all the contents of a specific file folder as attachments. I have been able to get the email created and drop it into the Outlook...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.