Outlook VBA in Excel

blackorchids2002

Board Regular
Joined
Dec 29, 2011
Messages
138
Hi Masters,

This is the first time I will post this particular forum "General Excel Discussion & Other Questions".

I have created a vba code in excel to send an appointment/meeting in Outlook. I have a leave form request that I want to automate. For monitoring purposes in my calendar for those employee who will take their time off, I created below code.

Is it possible that the "Required Attendees" calendar status on the invite would be displayed as Out of Office" and the one who send the invite (which is the team lead) on the calendar status would be displayed as "Free or available"?

.BusyStatus = 3 (this is the Out of Office status)
.RequiredAttendees = (this is the employee who would take the leave)



Here is my VBA code in excel :

Sub test ()
Dim oApp As Object, oApt As Object

'to create a clendar invite

Set oApp = CreateObject("Outlook.Application")
Set oApt = oApp.CreateItem(1)

On Error Resume Next

With oApt
.Subject = "PTO REQUEST APPROVED"
.Start = Now()
.End = Now()
.MeetingStatus = 1
.RequiredAttendees = ThisWorkbook.Sheets("PTO Request Form").Range("J8")
.BusyStatus = 3
.AllDayEvent = True
.ReminderSet = False
.Attachments.Add ThisWorkbook.FullName
.Display
.Send
End With

On Error GoTo 0

'Restores screen updating and release Outlook
Application.ScreenUpdating = True
Set oApt = Nothing
Set oApp = Nothing
End Sub


Your reply is highly appreciated.

Thanks,
blackorchids2002
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,665
Messages
6,120,804
Members
448,990
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top