Я хочу принять или предварительно принять приглашения на собрание в Outlook, в зависимости от того, есть ли у меня встреча в то время. У меня настроено правило; насколько я знаю, он запускает VBA, но код не работает. Я не могу найти проблему с этим.Auto accept/auto pre accept
Sub AcceptDecline(oRequest As MeetingItem)
If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then
Exit Sub 'if this messageclass isn't a meeting request
End If
Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(True)
Dim myAcct As Outlook.Recipient
Dim myFB As String
Set myAcct = Session.CreateRecipient("[email protected]")
myFB = myAcct.FreeBusy(oAppt.Start, 5, False) 'gets the free or busy status of my calendar
Dim oResponse
Dim i As Long
Dim test As String
i = (TimeValue(oAppt.Start) * 288)
test = Mid(myFB, i - 2, (oAppt.Duration/5) + 2)
If InStr(1, test, "1") Then
Set oResponse = oAppt.Respond(olMeetingTentative, True)
oResponse.Display
oResponse.Send
Else
Set oResponse = oAppt.Respond(olMeetingAccepted, True)
oResponse.Display
oResponse.Send
End If
End Sub
Вы отлаживаете код? –
@Nathan_Sav Боюсь, я не знаю, как ... Я нашел [этот вопрос] (http://stackoverflow.com/questions/5029141/debugging-an-outlook-2007-script-fired-by-a -ru), но он не объясняет, как вводить параметр MeetingItem, и кажется, что объект не может быть создан (см. [this ref] (https://msdn.microsoft.com/en-us/library/office /ff868714.aspx)) – RhysO
Использовать точки останова, быстро просмотреть Google. Я пытаюсь что-то подобное, поэтому проверьте ответ на этот http://stackoverflow.com/questions/32974269/get-meeting-time-when-accepting-meeting –