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.NotesS
ession")
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("B
ODY")
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
Start Free Trial