?
Solved

global attacment running lotus notes

Posted on 2003-10-21
8
Medium Priority
?
292 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
  • 3
  • 3
6 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
Industry Leaders: 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

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!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

809 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