INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How To

How to Use Automation to Add Meeting Request to Microsoft Outlook by hengsin
Posted: 29 May 03 (Edited 29 May 03)

BEFORE READ THIS FAQ, PLEASE GO TO http://support.microsoft.com/default.aspx?scid=kb;EN-US;209963 BECAUSE I'M ONLY ADD IN FEW LINES OF CODE. I AM WORKING ON MICROSOFT OFFICE 2000. I HAVEN'T TESTED IN OFFICE 97 OR OFFICE XP.

Private Sub cmdAddAppt_Click()
On Error GoTo Add_Err

    'Save record first to be sure required fields are filled.
    DoCmd.RunCommand acCmdSaveRecord

    'Exit the procedure if appointment has been added to Outlook.
    If Me!AddedToOutlook = True Then
        MsgBox "This appointment is already added to Microsoft Outlook"
        Exit Sub
    'Add a new appointment.
    Else
        Dim objOutlook As Outlook.Application
        
        Dim objAppt As Outlook.AppointmentItem

        Set objOutlook = CreateObject("Outlook.Application")
        Set objAppt = objOutlook.CreateItem(olAppointmentItem)
        
        'CHANGE APPOINMENT ITEM TO A MEETING
        objAppt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting
       
               
        'ADD ATTENDEE
        Dim oRecipt As Outlook.Recipient
    Dim strRecipients As String

        strRecipients = "Someone Name As in Global Address List"
                
        With objAppt
             'Add the recipient to the Meeting Request
             Set oRecipt = .Recipients.Add(strRecipients)
             oRecipt.Type = olTo
            
            .Start = Me!ApptDate & " " & Me!ApptTime
            .Duration = Me!ApptLength
            .Subject = Me!Appt
       
            If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes
            If Not IsNull(Me!ApptLocation) Then .Location = Me!ApptLocation
            If Me!ApptReminder Then
                .ReminderMinutesBeforeStart = Me!ReminderMinutes
                .ReminderSet = True
            End If
              
            
            .Save
            '.Close
            
            End With
            'Release the AppointmentItem object variable.
            Set objAppt = Nothing
            
           End If

    'Release the Outlook object variable.
    Set objOutlook = Nothing

    'Set the AddedToOutlook flag, save the record, display a message.
    Me!AddedToOutlook = True
    DoCmd.RunCommand acCmdSaveRecord
    MsgBox "Appointment Added!"

    Exit Sub

Add_Err:
    MsgBox "Error " & Err.Number & vbCrLf & Err.Description
    Exit Sub
End Sub


Microsoft provides a method on how to use automation to add appoinments to Microsoft Outlook on this webpage, http://support.microsoft.com/default.aspx?scid=kb;EN-US;209963. What if someone tries to add meeting request? Actually it's really simple. If you open up the Microsoft Outlook and click on New Appoinment. You can see at the top of the Appoinment Form is a button call "Invite Attendees". If you clicked on it, the "To" field will be seen in the Appoinment Form and instantly the title of the Appoinment Form will become Meeting. To change the Appoinment to become Meeting Request, you only need this line of code:
 
         'CHANGE APPOINMENT ITEM TO A MEETING
        objAppt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting

To add the attendee into the Meeting Request, you need only those code:

 'ADD ATTENDEE
        Dim oRecipt As Outlook.Recipient
    Dim strRecipients As String

        strRecipients = "Someone Name As in Global Address List or Email address"
                
        With objAppt
             'Add the recipient to the Meeting Request
             Set oRecipt = .Recipients.Add(strRecipients)
             oRecipt.Type = olTo

Because i am working in an organization using Microsoft Outlook. Everyone email address is inside the Global Address List. If i typed person's name according to the format in Global Address List, his or her email address will automatically insert.



Back to Microsoft: Access Modules (VBA Coding) FAQ Index
Back to Microsoft: Access Modules (VBA Coding) Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close