Outlook Meeting Macro

heffo500

New Member
Joined
Sep 28, 2016
Messages
44
Hi

I have never used VBA for Outlook before and was wondering would this be possible.

I am looking to try schedule a macro to book a specific meeting room on specific days due to current restrictions on how far ahead the systems lets me book so currently I can I book the meeting room up to 4 days in advance. See below:

Monday Friday
Tuesday
Wednesday
Thursday Monday
Friday Tuesday
Saturday Wednesday
Sunday Thursday

So I am trying to build a macro that at 7am on Monday, it fire off and book the room for the following Friday and so on as above.

Is this possible?

Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi

A timer could be implemented in Outlook, but it is a bit more complicated, I opted to use the “on time” method within Excel:


Code:
' Excel module
Dim num%, d As Date


Sub Sched()
Dim ns As Namespace, cal As Folder, a As AppointmentItem, olapp As Outlook.Application
Set olapp = Outlook.Application
If Weekday(d + 4) = 1 Or Weekday(d + 4) = 7 Then Exit Sub   ' weekend
Set ns = olapp.GetNamespace("MAPI")
Set cal = ns.GetDefaultFolder(olFolderCalendar)
Set a = cal.Items.Add(olAppointmentItem)
With a
    .MeetingStatus = olMeeting
    .Subject = "Periodic Conclave #" & num
    .Body = "See attached document"
    .Start = d + 4 + TimeSerial(3 + num, 0, 0)
    .End = d + 4 + TimeSerial(3 + num, 30, 0)
    .Recipients.Add ("bosworth@surf.com")
    .Location = "Ruby Room"
    .Display
End With
End Sub


Sub RunOnTime()                                 ' run this one
Dim ndays%, tofday As Date
tofday = TimeSerial(20, 5, 0)                   ' time of day to book room
'ndays = ndays + 1                              ' add one day to date when macro will run
d = WorksheetFunction.RoundDown(Now + ndays, 0) + tofday + TimeSerial(0, 0, 20 * num)
Application.OnTime d, "RunOnTime"               ' schedule event
num = num + 1
If num > 3 Then                                 ' number of scheduled events
    Application.OnTime d, "RunOnTime", , False
    MsgBox "cancelled"
Else
    Sched
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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