Skip to main content

Automation:- Sending Invitation to Meeting Using Excel VBA

Hello Everyone,

In one of the previous post, I wrote about automating Sending Emails using Excel VBA. This time I have come up with a pretty similar code. The code below sends Outlook Meeting Invitations to recipients on one click. here is the Code:-

       
Sub Send_Invite_Auto()
    
    Dim olApp As Outlook.Application
    Dim olApt As AppointmentItem
    
    Set olApp = New Outlook.Application             'Creating Outlook Session
    Set olApt = olApp.CreateItem(olAppointmentItem) 'Creating an Appointment
    
    With olApt
        .Subject = "Enter the subject here."        'Subject
        .Start = DateAdd("d", 5, Now)               'Enter Date + Time here.
        .Recipients.Add ("example@gmail.com")       'Recipient Name, Alias, or any other Attribute.
        .MeetingStatus = olMeeting                  'olAppointmentItem with Meeting status olMeeting
                                                    'becomes a OL Meeting Item.
                                                    
        .Duration = 30                              'In Minutes
        .Body = "Enter your Body Text Here."        'Body
        .Location = "Office"                        'Location of the meeting.
        .Display                                    'for Displaying olMeeting window.
    End With
    
    Application.Wait DateAdd("s", 2, Now)           'waiting for 2 sec to let OL window to display.
    SendKeys "%s", True                             'Sending Mail.
    Set olApt = Nothing
    
    MsgBox "Invite Sent", vbInformation
    
End Sub
       
 

Remarks:-
Its better to use Early Binding. So before running the above code. Make sure, you make a reference to the Microsoft Outlook xx.xx Library. For this, go to Tools menu in the VBE Window and option Reference option. It will list all the available libraries. Find the required one and check the check box and click OK. thats it.

Here is the Excel Forum Link of an alike Post:-
http://www.excelforum.com/excel-programming-vba-macros/1070255-sending-invite-through-outlook-2007-via-excel-macro-or-vba.html

Regard,
Vikas Gautam

Comments

Post a Comment