我正在尝试从 VBA 宏生成约会并将其放入 Outlook 中的日历中。我的代码在下面...
Sub CommandButton1_Click()
Const olAppointmentItem As Long = 1
Dim olapp As Object
Dim OLNS As Object
Dim OLAppointment As Object
On Error Resume Next
Set olapp = GetObject(, "Outlook.Application")
If olapp Is Nothing Then Set olapp = CreateObject("Outlook.Application")
On Error GoTo 0
If Not olapp Is Nothing Then
Set OLNS = olapp.GetNamespace("MAPI")
OLNS.Logon
Set OLAppointment = olapp.CreateItem(olAppointmentItem)
OLAppointment.Subject = "Request for Leave"
OLAppointment.Start = TimeValue(TextBox7.Text)
OLAppointment.End = TimeValue(TextBox10.Text)
OLAppointment.Location = "Leave"
OLAppointment.Body = "Request for Leave"
OLAppointment.Save
'Set OLAppointment = olapp.Move(olfolder)
Set OLAppointment = Nothing
Set OLNS = Nothing
Set olapp = Nothing
End If
End Sub
问题是约会的日期从“1899 年 12 月 30 日星期六”开始,并且只持续半小时,而我需要它在两个日期之间的几天内持续作为全天约会,(开始日期:TextBox7)(结束日期:TextBox10)。
另一个问题是我如何将此请求发送给某人?
约会详细信息来自 Excel 用户窗体的文本字段
谢谢