By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

How did I add a 'Snapshot' attachment & email it Via Lotus Notes

P: 5
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 below: -

Public Sub SEND_EMAILS()

Dim session As Object
Dim db As Object
Dim doc As Object
Dim rtitem As Object
Dim rtitem_rtf As Object
Dim t_rpt_Name As String

Set session = CreateObject("Notes.NotesSession")
Set db = session.CurrentDatabase
Set doc = db.CreateDocument

'output report to text file on C:\

DoCmd.OutputTo acOutputReport, rpt_Name, acFormatSNP, ("C:\" & rpt_Name), False

doc.Form = "Memo"
doc.SendTo = temp_ccList
doc.subject = subject
doc.Body = Message


'Attach Doc 1
Set rtitem = doc.CreateRichTextItem("Attachment")
Call rtitem.EMBEDOBJECT(1454, "", "C:\" & rpt_Name)
Call rtitem.ADDNEWLINE(1, True)


This appears to attach a Richtext version of the report (rather than a snapshot) to the email, & sends it via Lotus Notes. However, if I try to open the attachment, SNAPSHOT doesn't recognise it; strangley I can view just the text part of the attachment if I just 'View' it within lotus notes.

How can I attach the report attachment so snapshot can open it (from Lotus Notes)?


Thanks in advance

Mark
Dec 13 '07 #1
Share this Question
Share on Google+
2 Replies


Dököll
Expert 100+
P: 2,364
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 below: -
Expand|Select|Wrap|Line Numbers
  1. Public Sub SEND_EMAILS()
  2.  
  3. Dim session As Object
  4. Dim db As Object
  5. Dim doc As Object
  6. Dim rtitem As Object
  7. Dim rtitem_rtf As Object
  8. Dim t_rpt_Name As String
  9.  
  10. Set session = CreateObject("Notes.NotesSession")
  11. Set db = session.CurrentDatabase
  12. Set doc = db.CreateDocument
  13.  
  14. 'output report to text file on C:\
  15.  
  16. DoCmd.OutputTo acOutputReport, rpt_Name, acFormatSNP, ("C:\" & rpt_Name), False
  17.  
  18. doc.Form = "Memo"
  19. doc.SendTo = temp_ccList
  20. doc.subject = subject
  21. doc.Body = Message
  22.  
  23.  
  24. 'Attach Doc 1
  25. Set rtitem = doc.CreateRichTextItem("Attachment")
  26. Call rtitem.EMBEDOBJECT(1454, "", "C:\" & rpt_Name)
  27. Call rtitem.ADDNEWLINE(1, True)
  28.  
This appears to attach a Richtext version of the report (rather than a snapshot) to the email, & sends it via Lotus Notes. However, if I try to open the attachment, SNAPSHOT doesn't recognise it; strangley I can view just the text part of the attachment if I just 'View' it within lotus notes.

How can I attach the report attachment so snapshot can open it (from Lotus Notes)?


Thanks in advance

Mark
Hello MarkStorer!

Do youy mean firing a button that add an attachment to the body of a Notes email? Below VBA code which I use rather frequently, helps add such attachment, if you have Notes running:

Expand|Select|Wrap|Line Numbers
  1. Private Sub EmailAttachment_Click()
  2. On Error GoTo Err_MailMeReport_Click
  3.     Dim stDocName As String
  4.     Dim stPersonName As String
  5.     stDocName = "YourData" 'form being added to email
  6.     stPersonName = AssignedTo 'field that pulls email recipient
  7.     DoCmd.SendObject acForm, stDocName, , AssignedTo, , , "Please take a look, what are your thoughts?"
  8. Exit_MailMeReport_Click:
  9.     Exit Sub
  10. Err_MailMeReport_Click:
  11.     MsgBox "You have chosen to cancel the email", vbInformation + vbOKOnly, _
  12.                "Data Central" 'Err.Description
  13.     Resume Exit_MailMeReport_Click
  14. End Sub
  15.  
You will therefore have the option of adding as Snapshot or else...

Try it!
Dec 16 '07 #2

P: 5
Hi Dököll

Thanks for your reply !

I've tried your code & it works a treat for outlook - I will use it in future applications if you don't mind ;-)

However the SendObject method is unreliable for LotusNotes clients (for some clients, it works & for others, it doesn't) the only methodolgy I've known to be reliable are variations of the script I've posted (which is basically a script released from this excellent forum).

However I've not found a LotusNotes-reliable script which can send anything other than an rtf format - unfortunately I need to send a snapshot (or PDF I guess) as I have a graph in my attachment the rtf format doesn't display graphics.

Any thoughts ?

Cheers

Mark
Dec 17 '07 #3

Post your reply

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