2014-02-17 99 views
0

我正在嘗試創建一個工具來生成使用Excel和Lotus notes的會議邀請,並且能夠使用代碼I生成我想要的電子郵件在StackOverflow和Lotus Notes API中找到。使用VBA在Lotus Notes中保存會議時刪除「發送邀請」消息

唯一的細節是,當我嘗試在日曆中保存會議(不發送它,只保存爲草稿以便發送邀請時可以檢查會議詳細信息),Lotus Notes將顯示以下消息: Send invitation message

有沒有辦法刪除此消息,以便用戶不會看到此消息? 生成會議的代碼如下:

Private Sub salvaAppointment() 

    'Lotus notes objects 
    Set session = CreateObject("Notes.NotesSession") 
    Set Db = session.GetDatabase("", "") 

    'Prepare a document for the meeting 
    Call Db.OPENMAIL 
    Set doc = Db.CreateDocument 
    Set richText = doc.CreateRichTextItem("Body") 

    'Set meeting properties 
    Call doc.ReplaceItemValue("Form", "Appointment") 
    Call doc.ReplaceItemValue("AppointmentType", "3") 
    doc.Subject = "Reunião Caixa Rápido" 
    doc.CALENDARDATETIME = DateAdd("h", 15, Date) 
    doc.StartDateTime = DateAdd("h", 15, Date) 
    doc.EndDateTime = DateAdd("h", 17, Date) 
    doc.StartDate = Date 
    doc.Location = "Sala CCB" 

    'Email body 
    Call richText.AppendText("Modelo A3: ") 
    Call richText.AddNewLine(1, True) 
    modA3 = Application.ActiveWorkbook.Path & "\A3 Mod Modelo teste.ppt" 
    Call richText.EmbedObject(1454, modA3, modA3, "Attachment") 
    Call richText.AddNewLine(2, True) 
    Call richText.AppendText("**template**") 
    Call richText.Update 

    'Opens UI object to edit the document 
    Set UIWorkSpace = CreateObject("Notes.NotesUIWorkspace") 
    Set uidoc = UIWorkSpace.EDITDocument(True, doc) 

    'Fills meeting required destination 
    Set nomes = Range(Range("F1"), Range("F" & Rows.Count).End(xlUp)) 
    For Each nome In nomes 
     Call uidoc.FieldAppendText("EnterSendTo", nome & ",") 
    Next nome 

    'Copy Excel cells to clipboard 
    Dim lastRow As Integer 
    lastRow = Range("E" & Rows.Count).End(xlUp).Row 
    Range("A1:E" & lastRow).Copy    'CHANGE SHEET AND RANGE TO BE COPIED AND PASTED 
    'Create a temporary Word Document 
    Set WordApp = CreateObject("Word.Application") 
    WordApp.Visible = False         'True to aid debugging 
    Set wdTemplate = WordApp.Documents.Open(Application.ActiveWorkbook.Path & "\templateEmail.doc") 
    'Paste into Word document and copy to clipboard 
    With wdTemplate.Bookmarks 
     .item("tabela").Range.PasteSpecial DataType:=10 
    End With 
    With WordApp.Selection 
     .WholeStory 
     .Copy 
    End With 

    'Find the marker text in the Body item 
    uidoc.GotoField ("Body") 
    uidoc.FINDSTRING "**template**" 
    'Paste from clipboard (Word) to Lotus Notes document 
    uidoc.Paste 
    Application.CutCopyMode = False 
    WordApp.Quit False 

    'When I call the below line, it displays the message 
    Call uidoc.Save 

    uidoc.Close 

    'Liberar memória 
    Set session = Nothing 
    Set UIWorkSpace = Nothing 

    'Deleta as planilhas temporárias 
    Sheets("dados").Delete 
    Sheets("temp").Delete 

End Sub 

我很感激任何幫助。

回答

1

便箋識別一個名爲MailOptions的保留字段,用於在保存文檔時控制自動發送電子郵件。嘗試在您設置了會議屬性註釋的代碼塊中添加此代碼:

doc.ReplaceItemValue("MailOptions","0")