1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| Set fs = createobject("Scripting.FileSystemObject")
if fs Is Nothing Then
MsgBox "Could Not Create FileSystemObject",16,"File System Object Error."
endMe
Exit Sub
End if
fName = inputbox("Please enter the full path For the file","Enter Full Path To File","C:\")
if fName = "" Then
MsgBox "Empty Path"
endMe
Exit Sub
End if
path = fs.GetAbsolutePathName(fName)
if Not fs.FileExists(path) Then
MsgBox "File does Not exist In directory you specified"
endMe
End if
Set s = createobject("Notes.NotesSession")
if s Is Nothing Then
MsgBox "Could Not Create A Session Of Notes",16,"Notes Session Error."
endMe
Exit Sub
End if
'See if we can create the main object (s
' ession)
if Err.Number <> 0 Then
On Error Goto 0
MsgBox "Could Not create session 'Lotus Notes' from object"
Exit Sub
End if
Set db = s.getdatabase(s.getenvironmentstring("MailServer",True),s.getenvironmentstring("Mailfile",true))
'See if we can a handle on the mail file
'
if Err.Number <> 0 Then
On Error Goto 0
MsgBox "Could find or Get a handle on the mail file"
Exit Sub
End if
Set doc = db.createdocument
Set rtitem = doc.createrichtextitem("BODY")
recips(1) = "xxx@xxx.com"
recips(2) - "rrr@rrr.com"
With doc
.form = "Memo"
.subject = subj
.sendto = "<xxx>@xxx.com"
.copyto = "<yyy>@yyy.com"
.body = bdy
.postdate = Date
End With
call rtitem.embedobject(1454,"",fName)
doc.visible = True
doc.send False
'if we made it this far, alert the user
' the mail memo has been created and sent
MsgBox "You message has been created and sent." & chr(13) & "Thank you.",64,"Message Sent Notification."
endMe
End Sub
Sub endMe()
'clean objects/memory
Set s = nothing
Set db = nothing
Set doc = nothing
Set rtitem = nothing
Set fs = nothing
End Sub |
Partager