Hello,
I have the following code which attaches an file to an email and sends to a distribution list. The problem I have is that I want the email to pick up the same name as the file attachment. It can change the code to factor in a different attachment name due to date stamp.
I wish to also check the atatchment before it is sent to check that the file is correct. what is the best way to put a limit on the code that I can check the file and then send?
Testing this code I sent an email to myself but opening the attachment there is an excel message asking if I wish to update links but when I open the file saved in its drive there is no such message. How do I stop this message. Any pointers for these areas would be greatly appreciated.
Sub lotuscode()
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 = "Subject in here"
oDoc.sendto = "Email address or Group here"
oDoc.body = ""
oDoc.postdate = Date
oDoc.SaveMessageOnSend = True
'Attaching DATABASE
Call oItem.EmbedObject(1454, "", "ILocation of the file you wish to send here inc the .xls etc")
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
I have the following code which attaches an file to an email and sends to a distribution list. The problem I have is that I want the email to pick up the same name as the file attachment. It can change the code to factor in a different attachment name due to date stamp.
I wish to also check the atatchment before it is sent to check that the file is correct. what is the best way to put a limit on the code that I can check the file and then send?
Testing this code I sent an email to myself but opening the attachment there is an excel message asking if I wish to update links but when I open the file saved in its drive there is no such message. How do I stop this message. Any pointers for these areas would be greatly appreciated.
Sub lotuscode()
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 = "Subject in here"
oDoc.sendto = "Email address or Group here"
oDoc.body = ""
oDoc.postdate = Date
oDoc.SaveMessageOnSend = True
'Attaching DATABASE
Call oItem.EmbedObject(1454, "", "ILocation of the file you wish to send here inc the .xls etc")
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