添加位置和密件抄送/资源-不更新位置

问题描述 投票:1回答:1

我已经在Excel中编写了一个宏,可以通过Outlook发送日历邀请(约会)。 收件人必须是密件抄送(添加到“资源”字段中。)>

我在日历约会的正文中有文字。看来,通过结合使用WordEditor和bcc / resources,我在每次发送之前都会收到一个警报弹出窗口:“您要将位置更新为...吗?”enter image description here

我不想更新/更改位置,因为它会被收件人列表取代,从而打消了密件抄送的原因(收件人会将位置视为整个收件人列表)。

如果删除将文本添加到正文的代码块(以“ Set ActInsp ...”开头),则不会出现此警报,并且其他所有内容都可以正常运行;但是,我需要带有超链接的文本正文

gif如何手动复制“更新位置”警报。enter image description here

下面是宏的工作示例。带有WordEditor的代码块显示在底部,在.Display.

的正上方

请确保添加参考:Microsoft Outlook 16.0对象库(我无法使后期绑定起作用)。

Sub SendAppointments_SingleEmail()

Dim olApp As Object
Set olApp = CreateObject("Outlook.Application")
'Requires early binding (late binding not working):
' Go to the Tools menu, Resources. Add Microsoft Outlook 16.0 Object Library
'Because AppointmentItem does not use HTML, must utilize Word VBA
Dim ActInsp As Outlook.Inspector

'Static fields
emailFrom = "[email protected]"
emailSubject = "My Subject"
emailBody = "Body of calendar invite"
hyperlink = "https://www.register.com/"
emailLocation = "My Location"
appt_Date = #7/30/2019#
appt_Time = #3:00:00 PM#
appt_Duration = "90"

'Create Appointment and Send
Set myAppt = olApp.CreateItem(olAppointmentItem)
With myAppt
    .MeetingStatus = olMeeting
    .SendUsingAccount = emailFrom
    .Subject = emailSubject
    .Location = emailLocation
    .Start = appt_Date & " " & appt_Time
    .Duration = 90

    Set myResourceAttendee = .Recipients.Add("[email protected]")
    myResourceAttendee.Type = olResource 'Add as a Resource/BCC

    Set ActInsp = myAppt.GetInspector
    With ActInsp
        .WordEditor.Characters(1).InsertBefore (emailBody & vbNewLine & vbNewLine & hyperlink)
        .Close (olSave)
    End With

    .Display
    '.Send

End With 'myAppt

End Sub

我已经在Excel中编写了一个宏,可以通过Outlook发送日历邀请(约会)。收件人必须是密件抄送(添加到“资源”字段中)。我在日历约会的正文中有文字。它...

excel vba outlook-vba
1个回答
0
投票
而不是从ActInsp关闭对象,而是关闭myAppt对象。
© www.soinside.com 2019 - 2024. All rights reserved.