473,419 Members | 3,464 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,419 software developers and data experts.

Send email message via lotus notes with 2 attachments from Access

5
OS: Windows XP Professional
Access 2003
Lotus Notes 7

I am trying to send a email message from Access that will have 2 attachments that are excel versions of 2 separate queries.

I can send 1 attachment using the "sendObject" macro but it is not flexible enough to accept 2 attachments.

The twist on all of this is i need to use Notes as my email client as that is what my department uses.

Any hints or tips on where to start would be greatly appreciated.

Mike
Sep 3 '07 #1
3 8932
MMcCarthy
14,534 Expert Mod 8TB
Hi Mike,

Try this code ...

Expand|Select|Wrap|Line Numbers
  1. Public Sub SendNotesMail()
  2. Dim notesDb As Object 'The mail database
  3. Dim UserName As String 'The current users notes name
  4. Dim notesDbName As String 'THe current users notes mail database name
  5. Dim notesDoc As Object 'The mail document itself
  6. Dim notesRtf As Object 'The attachment richtextfile object
  7. Dim notesSession As Object 'The notes session
  8. Dim EmbedObj As Object 'The embedded object (Attachment)
  9. Dim attach1 As String
  10. Dim attach2 As String
  11.  
  12.     'Start a session to notes
  13.     Set notesSession = CreateObject("Notes.NotesSession")
  14.  
  15.     'Get the sessions username and then calculate the mail file name
  16.     'You may or may not need this as for notesDBname with some systems you
  17.     'can pass an empty string
  18.     UserName = Session.UserName
  19.     notesDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
  20.  
  21.     'Open the mail database in notes
  22.     Set notesDb = Session.GETDATABASE("", notesDbName)
  23.  
  24.     If notesDb.IsOpen = False Then
  25.          notesDb.OPENMAIL
  26.     End If
  27.  
  28.     'Set up the new mail document
  29.     Set notesDoc = Maildb.CREATEDOCUMENT
  30.     notesDoc.Form = "Memo"
  31.     notesDoc.sendto = "someone@somewhere.com"
  32.     notesDoc.Subject = "Title goes here"
  33.     notesDoc.Body = "User Text............"
  34.     notesDoc.SAVEMESSAGEONSEND = False
  35.  
  36.     'Set up the embedded object and attachment and attach it
  37.     attach1 = "C:\excelfile1.xls"
  38.     Set notesRtf = notesDoc.CREATERICHTEXTITEM("Attachment")
  39.     Set EmbedObj = notesRtf.EMBEDOBJECT(1454, "", attach1, "Attachment")
  40.     MailDoc.CREATERICHTEXTITEM ("Attachment")
  41.  
  42.     attach2 = "C:\excelfile2.xls"
  43.     Set notesRtf = notesDoc.CREATERICHTEXTITEM("Attachment")
  44.     Set EmbedObj = notesRtf.EMBEDOBJECT(1454, "", attach2, "Attachment")
  45.     MailDoc.CREATERICHTEXTITEM ("Attachment")
  46.  
  47.     'Send the document
  48.     notesDoc.SEND 0, Recipient
  49.  
  50.     'Clean Up
  51.     Set notesDb = Nothing
  52.     Set notesDoc = Nothing
  53.     Set notesRtf = Nothing
  54.     Set notesSession = Nothing
  55.     Set EmbedObj = Nothing
  56.  
  57. End Sub
  58.  
Sep 5 '07 #2
Mike D
5
Thanks for the reply, i get an error on line 29

Runtime error 424
Object required

....help????


thanks

Mike
Sep 10 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Sorry Mike, my fault.

Change the line to ...

Set notesDoc = notesDb.CREATEDOCUMENT
Sep 10 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dodge Brown | last post by:
Hi All Has anyone got a reference point where I can get an example of sending an email via Lotus Notes using Access 2k. Thanks in Advance Dodge
7
by: Ajit | last post by:
Is there anyway i can download/check EMail and/or Emails with attachments Using VB.Net The application i am working on need to download attachments and update database
0
by: Brian Green | last post by:
Hi, I need to send an attachment from PCs that don't have direct access to the internet but have lotus notes email clients. I've looked at the 'mailto' url (won't do attachments) and attempted...
4
by: navyliu | last post by:
I want send Lotus Notes Email automatic in my Application.I googled this topic but I can't find the solution. Does anyone have ever use this function?Can you give me some advice? Thanks a lot!
3
by: Eric Layman | last post by:
Hi, Can asp.net 1.1's Mail object autheticate user information via Lotus Notes? For IIS's built in SMTP, it can be done via CDO SYS: ...
2
by: madmak | last post by:
Hi, I am a noob with PHP and need some asistance regarding PHP and lotus notes. I am trying to create a multipart message in PHP to send mail via lotus notes. Here is the code snippet. ...
3
by: =?Utf-8?B?SmFtZXNU?= | last post by:
I can create a message and send it via my btopenworld account but is the method the same when using Lotus Notes. I have no experience of Lotus Notes whatsoever. I have never seen it at all. ...
2
by: MarkStorer | last post by:
Hi All I need to email a report (with contains graphs) via Lotus Notes. I've tried the 'SendObjectSnp' method (which works with some Lotus Notes clients (but not many others)); so I used the code...
0
by: Kristoph | last post by:
Hello, I would like to send an Access report as text in the body of a Lotus Notes email. Currently I am using DoCmd.SendObject which sends the report as a text attachment just great! But,...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.