简体   繁体   English

使用 Excel VBA 通过 Lotus Notes 发送电子邮件

[英]Sending email via Lotus Notes using Excel VBA

I've been studying how to send emails via Lotus Notus but my database is wrong.我一直在研究如何通过 Lotus Notus 发送电子邮件,但我的数据库是错误的。

I tried to put "", "" without success.我试图把“”,“”没有成功。

Dim MailData As Object 'The email database
Dim Maildoc As Object 'The email itself
Dim Session As Object 'The notes session
    
linha = 2

Do Until Cells(linha, 1) = ""

    Set Session = CreateObject("Notes.NotesSession")
    Set MailData = NotesSession.GetDatabase("", "C:\Program Files (x86)\IBM\Lotus\Notes.exe")

    If MailData.IsOpen = True Then
    Else
        MailData.Openmail
    End If

    Set Maildoc = MailDB.CreateDocument
    Maildoc.SendTo = Cells(linha, 8)
    Maildoc.Subject = "SYMRISE BR - Quotation" & " -" & Cells(linha, 1) & " -" & Cells(linha, 4)
    Maildoc.Body = "Dears, & Chr(10) & Chr(10) & Cells(15,14) & Chr(10) & Chr(10) & Cells(1,1) & "" & Cells(linha, 1) & "
    Chr (10) & Cells(1, 2) & "" & Cells(linha, 2) & Chr(10) & Cells(1, 3) & "" & Cells(linha, 3) & Chr(10) & _
    Cells(1, 4) & " " & Cells(linha, 4) & Chr(10) & Cells(1, 5) & " " & Cells(linha, 5)
    
    Maildoc.SaveMessageonSend = True
   
Loop

You can't use "","" to identify a database in VBA.在 VBA 中不能使用 "","" 来标识数据库。 That works only in LotusScript code that is running inside the Notes client or on a Domino server.这仅适用于在 Notes 客户端或 Domino 服务器上运行的 LotusScript 代码。

And "C:\\Program Files (x86)\\IBM\\Lotus\\Notes.exe" isn't a database.并且“C:\\Program Files (x86)\\IBM\\Lotus\\Notes.exe”不是数据库。 It's a program.这是一个程序。 It's the Notes program.这是Notes程序。 A database is a file with a name that ends with ".NSF".数据库是名称以“.NSF”结尾的文件。

If you want to open the current user's personal email database, then you should be using the OpenMail method of the NotesDatabase enter link description here class.如果要打开当前用户的个人电子邮件数据库,则应使用 NotesDatabase 的OpenMail方法在此处输入链接描述类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM