"Karsten Hansen" <kaha@ticali.dk> wrote in message
news:3e4801c9$0$164$edfadb0f@dread15.news.tele.dk...
> Hej NG
>
> Jeg har en lille nød som jeg ikke kan knække, håber at der er nogen der
har
> et forslag.
>
> Jeg har et regneark, som jeg skal sende rundt til nogle mailmodtagere, men
> desværre har min EDB-chef skiftet Exchange serveren ud med Lotus Notes, så
> nu virker min makro ikke.
> Er der nogen der har et bud på hvordan jeg fikser dette problem.
> P.S. Regnearket er Excel XP og Lotus Notes er jeg ikker sikker på
>
> På forhånd tak for hjælpen
>
> Karsten Hansen
>
Hej Karsten,
Jeg anvender koden nederst i denne meddelelse til at sende via Lotus Notes.
Det bruges f.eks. således:
Dim recvrs(1 To 1) As String
Dim subj As String
Dim msg As String
Dim attch As String
recvrs(1) = "my@email.dk"
subj = "Tester notes mail"
msg = "Det virker!!!"
attch = "C:\MYTEST.TXT"
initNotesMail
SendNotesMail recvrs, "", "", subj, msg, attch, True
closeNotesMail
Håber det kan bruges.
Med venlig hilsen
Bjørn Jeberg
Paste dette ind i et modul:
Option Explicit
Private Session As Object 'The notes session
Private Maildb As Object 'The mail database
Const MailDbName = "mail\common.nsf"
Public Sub SendNotesMail(Recipient() As String, CabinCopy As String,
BlindCopy As String, Subject As String, BodyText As String, Attachment As
String, SaveIt As Boolean)
'Set up the objects required for Automation into lotus notes
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile
object
Dim EmbedObj As Object 'The embedded object
(Attachment)
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Recipient
MailDoc.CopyTo = CabinCopy
MailDoc.BlindCopyTo = BlindCopy
MailDoc.Subject = Subject
MailDoc.Body = BodyText
MailDoc.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
End If
'Send the document
MailDoc.SEND 0, Recipient
Set MailDoc = Nothing
Set AttachME = Nothing
Set EmbedObj = Nothing
End Sub
Public Sub initNotesMail()
'Dim UserName As String 'The current users notes name
'Start a session to notes
Set Session = CreateObject("notes.notessession")
'Get the sessions username and then calculate the mail file name.
'UserName = Session.UserName
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("NameOfServer", MailDbName)
If Maildb.ISOPEN = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
End Sub
Public Sub closeNotesMail()
On Error Resume Next
Maildb.Close
Session.Close
On Error GoTo 0
Set Session = Nothing
Set Maildb = Nothing
End Sub
|