I actually wanna know the required steps to connect excel
to Lotus Notes application in Excel VB code, in order to
directly send an e-mail with an attached sheet.
Does anybody know ?
Kriss
Try it and post back with the result
See the example code on this page
http://www.rondebruin.nl/sendmail.htm
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl
"Kriss" <cugn...@yahoo.com> wrote in message news:033901c331e1$40997fb0$a301...@phx.gbl...
Sub Send_ETCMail()
Dim oSess As Object, msg As String
Dim oDB As Object
Dim oDoc As Object
Dim oItem As Object
Dim direct As Object
Dim var As Variant
Dim flag As Boolean
On Error GoTo Error1
Set oSess = CreateObject("notes.notessession")
Set oDB = oSess.getdatabase("SERVER NAME HERE", "")
Call oDB.openmail
flag = True
With ThisWorkbook.Sheets("Send Parameters") 'I set up a
datalist in the workbook for this
AttachPath = .Range("AttachPath") 'You can do
this with text
AttachName = .Range("AttachName") '
To_Address = .Range("To_Address") '
To_Name = .Range("To_Name") '
InstrText = .Range("InstrText") '
End With
AttachFile = AttachPath & "/" & AttachName
msg0 = "AUTOMATED MESSAGE TEXT IF DESIRED"
If Not (oDB.IsOpen) Then flag = oDB.Open("", "")
If Not flag Then
MsgBox "Cant't open mail file: " & oDB.server & " " &
oDB.FilePath
GoTo Error1
End If
Set oDoc = oDB.createdocument
Set oItem = oDoc.createrichtextitem("BODY")
oDoc.Form = "Memo"
oDoc.Subject = "Estimate To Complete File for Review"
oItem.appendtext ("ETC File Attachment")
oItem.addnewline (2)
On Error GoTo err02
oItem.embedObject 1454, "", AttachFile, "mail.rtf"
S001:
If rtn01 = vbOK Then msg = NoAttach_msg & msg
oDoc.sendto = To_Address
oDoc.body = msg0
oDoc.postdate = Date
oDoc.SaveMessageOnSend = True
oDoc.Send False
Exit Sub
Error1:
On Error Resume Next
MsgBox "Error in Lotus Notes Email Script"
Set oItem = Nothing
Set oDoc = Nothing
Set oDB = Nothing
Set oSess = Nothing
Exit Sub
err02:
Err.Clear
msg1 = "Attachment: [" & AttachName & "]" & " Was Not
Found in" & vbCrLf & " Directory: [" & AttachPath & "]"
msg1 = msg1 & vbCrLf & vbCrLf
msg1 = msg1 & "Do you wish to send advisory email without
attachment?"
rtn01 = MsgBox(msg1, vbCritical + vbOKCancel, "PSR SendMail
Utility")
If rtn01 = vbOK Then Resume S001
msg2 = "SendMail Routine Aborted for Recipient:" & vbCrLf &
" [" & To_Address & "]"
rtn02 = MsgBox(msg2, vbOKOnly, "PSR SendMail Utility")
End Sub
"Ron de Bruin" <ronde...@kabelfoon.nl> wrote in message
news:OYByJKeM...@tk2msftngp13.phx.gbl...
It correctly find my mail application but a popup appears
named "Lotus Notes Mailman error" with the message :
couldn't attach file...and a second one : exception
occured...
Sound like I cannot attach file via Excel macro...
Would you have other ideas ?
Kriss
>.
>
Or you can do this Kriss
You can use OE for example next to Lotus Notes.
Add a account to OE
In your internet browser Tools>Internet Options change to OE
When you send via a macro the account in OE will be used.
For all other things you can use Lotus Notes
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl
"Kriss" <cugn...@yahoo.com> wrote in message news:03df01c33208$3beada00$a501...@phx.gbl...