0
我正在嘗試從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
的問題是,這一任命被日開始對「週六30/12/1899」,只有當我需要它的持續時間持續了半小時作爲全天約會的兩天之間的天數(開始日期:TextBox7)(結束日期:TextBox10)。
另一個問題是我將如何將此請求發送給某人?
約會細節是從Excel用戶窗體的文本字段
感謝