?
Solved

global attacment running lotus notes

Posted on 2003-10-21
8
Medium Priority
?
283 Views
Last Modified: 2013-12-25
Could you please help!!!!!!

I am using the following codes to send mail and it is working fine
as long as I hard code the attachment file and e_mail address in the macro as you see (where is not desirable any more)

Question

Question1-How can I use it as a global attachment for example
Call oItem.EmbedObject(1454, "", "c:\data\*.xls")

Question2- What modification I need to do in my macro for following data file to sent each report to a address (Example send  *Q4-2003-all.xls to manager@hotmail and
*Q4-2003-customer to teamleader@hotmail.com and *Q4-2003-Errors.xls to sale@hotmail.com)

custAB Q4-2003-All.xls    custAB Q4-2003-Customer.xls   custAB Q4-2003-Errors.xls



Sub sendmail_to()
Dim oSess As Object
Dim oDB As Object
Dim oDoc As Object
Dim oItem As Object
Dim direct As Object
Dim Var As Variant
Dim flag As Boolean

Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GETDATABASE("", "")
Call oDB.OPENMAIL
flag = True
If Not (oDB.IsOpen) Then flag = oDB.Open("", "")

If Not flag Then
    MsgBox "Can't open mail file: " & oDB.SERVER & " " & oDB.FILEPATH
    GoTo exit_SendAttachment
End If
On Error GoTo err_handler
'Building Message
Set oDoc = oDB.CREATEDOCUMENT
Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
oDoc.Form = "Memo"
oDoc.Subject = " This is subject " 
oDoc.sendto = "customerAB@hotmail.com"
oDoc.Body = "This is the body of the mail"
oDoc.postdate = Date

'Attaching DATABASE
Call oItem.EmbedObject(1454, "", "c:\data\custAB Q4-2003-All.xls")
Call oItem.EmbedObject(1454, "", "c:\data\custAB Q4-2003-Customer.xls")
Call oItem.EmbedObject(1454, "", "c:\data\custAB Q4-2003-Errors.xls")
oDoc.visable = True
'Sending Message
oDoc.Send False
exit_SendAttachment:
On Error Resume Next
Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing
'Done
Exit Sub
err_handler:
          If Err.Number = 7225 Then
          MsgBox "File doesn't exist"
          Else
          MsgBox Err.Number & " " & Err.Description
          End If
On Error GoTo exit_SendAttachment
End Sub
0
Comment
Question by:melindaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 8

Expert Comment

by:ampapa
ID: 9597698
Try changing:

Call oItem.EmbedObject(1454, "", "c:\data\custAB Q4-2003-All.xls")

To:

attachment = "c:\data\custAB Q4-2003-All.xls"
Call AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
0
 

Author Comment

by:melindaj
ID: 9604694
I belief your are answering only my question1 if is so
I have modify the program but it produce Error 424 object require
do you have any suggestion
0
 
LVL 8

Accepted Solution

by:
ampapa earned 84 total points
ID: 9605525
Did you get the error on the line that I gave you?

The object "AttachME" should have been "oItem", sorry.

attachment = "c:\data\custAB Q4-2003-All.xls"
Call oItem.EMBEDOBJECT(1454, "", Attachment, "Attachment")

You'll need to create a loop for your e-mail addresses as opposed to your setup where you are establishing your mail to address and  the document. Your setup will create an e-mail to a single person with three attachments as opposed to an e-mail to 3 indivisuals with a single attachment.

...
'Building Message
Set oDoc = oDB.CREATEDOCUMENT
Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
oDoc.Form = "Memo"
oDoc.Subject = " This is subject " 
oDoc.sendto = "customerAB@hotmail.com"
...

If you want to increase the points I'd be glad to be a little more direct...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:melindaj
ID: 9611743
To be honest with you I am not a programmer and I need more help but that is beside the point.
I have tried your codes yes it attached a file. as well as my macro if I provide a full path name of the file name( I WANT TO AVOID TYPE THE FULL PATH NAME AND FILE NAME) then send the file as per file extension as you see in question2

Question2- What modification I need to do in my macro for following data file to sent each report to a address (Example send  *Q4-2003-all.xls to manager@hotmail and
*Q4-2003-customer to teamleader@hotmail.com and *Q4-2003-Errors.xls to sale@hotmail.com)

custAB Q4-2003-All.xls    custAB Q4-2003-Customer.xls   custAB Q4-2003-Errors.xls



To answer to your question  NO I do not know how to create loop to do the job PLEASE SHOW ME your code. and even I do not know how to
implement your codes with in my macro code

0
 
LVL 8

Expert Comment

by:ampapa
ID: 10347889
Seems like the questioner was asking for a lot for 21 points and I think I gave them 21 points worth of an answer, I recommend not deleting the question and awarding me the points.

Just my opinion.
0
 

Author Comment

by:melindaj
ID: 10762288
This question have been answred by ampapa please PAQ
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question