C
CSharp
C++
Java
Visual Basic
HTML - CSS
Android
Asp
Asp.Net
Php
Python
JavaScript
SQL
XML
Assembly
ActiveX
API
Code Snippets
Database
Files Directories Drives
Forms
Graphics Games
Multimedia
Strings
Windows and Controls
More...
Visual Basic > Internet Web Mail Stuff sample source codes
Visual Basic Code > Create an Outlook Appointment (or Meeting Request)
Create an Outlook Appointment (or Meeting Request) The following code demonstrates how to create an outlook meeting request. 'Purpose : Creates an outlook appointment. 'Inputs : sAttendees A comma seperated list of attendees. ' sSubject The subject of the request. ' dtStart The start date of the meeting. ' lDuration The duration of the meeting. ' [sLocation] The meeting location. 'Outputs : Returns True on success 'Notes : Function OutlookAppointment(sAttendees As String, sSubject As String, dtStart As Date, lDuration As Long, sLocation As String) As Boolean Dim oAppointment As Outlook.AppointmentItem Dim oOutlook As Outlook.Application Dim asAttendees() As String, lThisAttendee As Long On Error GoTo ErrFailed 'Instantiate objects Set oOutlook = New Outlook.Application Set oAppointment = Outlook.CreateItem(olAppointmentItem) 'Set meeting parameters oAppointment.Duration = lDuration '(in minutes) oAppointment.Location = sLocation oAppointment.MeetingStatus = olMeeting oAppointment.Start = dtStart oAppointment.Subject = sSubject 'Add attendees asAttendees = Split(sAttendees, ",") For lThisAttendee = 0 To UBound(asAttendees) With oAppointment.Recipients.Add(asAttendees(lThisAttendee)) .Type = 1 '1 = Required, 2 = Optional End With Next 'Send the appointment oAppointment.Send Set oAppointment = Nothing Set oOutlook = Nothing OutlookAppointment = True Exit Function ErrFailed: Debug.Print "Error in OutlookAppointment: " & Err.Description OutlookAppointment = False End Function 'Demonstration routine Sub Test() 'Add an appointment to go on holiday for 5 days OutlookAppointment "red", "On Holiday", Date, DateDiff("n", Date, Date + 5), "At home" End Sub
Privacy Policy
|
Contact
|
Advertising
|
Link to Us
|
Directory