Sending Outlook invite via Excel

housemd

New Member
Joined
Sep 3, 2014
Messages
10
Hi All,

I would like to send an outlook meeting invite via excel

I have the following code so for, which works for an appointment

Code:
Option Explicit

Private Sub meetingbooking()
    Dim objOL   'As Outlook.Application
    Dim objAppt 'As Outlook.AppointmentItem
    Const olAppointmentItem = 1
    Const olMeeting = 1


    Set objOL = CreateObject("Outlook.Application")
    Set objAppt = objOL.CreateItem(olAppointmentItem)
    With objAppt
        .Subject = "Meeting"
        .Start = "10/18/2014 09:30"
        .End = "10/18/2014 10:30"
        .Location = "xyz@company.com"
        .MeetingStatus = olMeeting ' make it a meeting request
        '.Attachments.Add attPath
        .Body = "This is a test-text in the message body..."
        .Display
    End With


    Set objAppt = Nothing
    Set objOL = Nothing


End Sub

I want the following changes to this code:

1. Make it a meeting instead of an appointment
2. Be able to book a room
3. Send the meeting request to another colleague of mine

Could anyone help me with how to proceed for these three changes?

Thanks in advance
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
1. Make it a meeting instead of an appointment
2. Be able to book a room
3. Send the meeting request to another colleague of mine
1. The .MeetingStatus = olMeeting line should already do that.
2. Set the .Location property.
3. Specify email address(es) in the RequiredAttendees or OptionalAttendees property.

Code:
Private Sub meetingbooking()
    Dim objOL   'As Outlook.Application
    Dim objAppt 'As Outlook.AppointmentItem
    Const olAppointmentItem = 1
    Const olMeeting = 1

    Set objOL = CreateObject("Outlook.Application")
    Set objAppt = objOL.CreateItem(olAppointmentItem)
    With objAppt
        .Subject = "Meeting"
        .Start = "10/18/2014 09:30"
        .End = "10/18/2014 10:30"
        .Location = "Meeting room"
        .MeetingStatus = olMeeting ' make it a meeting request
        .RequiredAttendees = "email1@email.com,email2@email.com"
        .OptionalAttendees = "email3@email.com"
        '.Attachments.Add attPath
        .Body = "This is a test-text in the message body..."
        .Display
    End With

    Set objAppt = Nothing
    Set objOL = Nothing

End Sub
 
Upvote 0
Thanks John, that worked.

Now I am just trying to tweak even the code you gave and see what all enhancements I can make. Do you have any suggestions for the following?

1. How to check if the meeting room which I am booking is free or already booked (I should be able to check its availability but not sure how)

2. This might be a little farfetched, but is there anyway I can override an existing booking and book the room in my name instead? (This would be awesome if I can get it to work)
 
Upvote 0
Is this a shared calendar? If so then I don't know.

For your own Outlook Calendar, you could read Outlook appointments for your date and time and see if the meeting room 'belongs' to one of the appointments. You may have to handle overlapping appointments to see if the meeting room is available. There is code at http://www.mrexcel.com/forum/excel-questions/470308-excel-outlook-appointment.html which checks if an appointment exists. You would have to modify this for your exact needs. To override an existing booking you may have to delete or change the appointment related to the booking.
 
Upvote 0
Is this a shared calendar? If so then I don't know.

For your own Outlook Calendar, you could read Outlook appointments for your date and time and see if the meeting room 'belongs' to one of the appointments. You may have to handle overlapping appointments to see if the meeting room is available. There is code at http://www.mrexcel.com/forum/excel-questions/470308-excel-outlook-appointment.html which checks if an appointment exists. You would have to modify this for your exact needs. To override an existing booking you may have to delete or change the appointment related to the booking.

Oh. So if someone else has booked the room and I do not have their credentials, then I cannot override the booking of the meeting room?
 
Upvote 0
If by credentials you mean access to the other person's Outlook (Calendar), then I don't think you can override the booking without access to their Calendar. You may want to look at sharing calendars, e.g. Share your calendar information - Outlook, however I've never done this so can't really help any further.
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

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