none
Create olMeeting in Outlook using VBA in Excel RRS feed

  • Frage

  • Dear all,

    I coded some lines to create a meeting in Outlook by VBA code in Excel (Excel and Outlook 2003).
    This works so far.
    But there is one problem: I have to invite attendees who shall get the meeting request by mail.
    How ever in the end when the Meeting is being diplayed I always have to click manually on the "Invite attendees" button.
    (btw after this manual click the required attendees show up automaticlly)
    So, is there a way to avoid the click on the "Invite attendees" button?
    Sub SetMeeting()
        Dim myOutlook As Object
        Dim myMeeting As Object
        
        Set myOutlook = CreateObject("outlook.application")
        Set myMeeting = myOutlook.CreateItem(1)
        
        With myMeeting
            .MeetingStatus = olMeeting
            .RequiredAttendees = "abc@abc.xyz"
            .Subject = "TEST Meeting"
            .Start = "09:00 am" & Format("25/01/2010", "mm/dd/yyyy")
            .End = "9:15 am" & Format("25/01/2010", "mm/dd/yyyy")
            .ReminderMinutesBeforeStart = 10
            .Save
            .Display
        End With
    
        Set myAppointment = Nothing
        Set myOutlook = Nothing
    End Sub
    
    Thanks for your help!

    Simon
    Freitag, 22. Januar 2010 10:04

Antworten

  • Hello Simon,

    If I execute the following code, I get a valid appointment in Outlook without any manual action.

    Some remarks.
    - Set "Option Explict": You set myAppointment to nothing, but your variable name is myMeeting
    - Better use early binding instead of late binding.

    Option Explicit

     

        Sub SetMeeting()

            Dim myOutlook As Outlook.Application

            Dim myMeeting As AppointmentItem

     

            myOutlook = CreateObject("outlook.application")

            myMeeting = myOutlook.CreateItem(olAppointmentItem)

     

            With myMeeting

                .MeetingStatus = olMeeting

                .RequiredAttendees = "user1@dummy.de;user2@dummy.de"

                .Subject = "TEST Meeting"

                .Start = Now()

                .End = Now() + 1

                .ReminderMinutesBeforeStart = 10

     

                .Display()

            End With

     

            myMeeting = Nothing

            myOutlook = Nothing

        End Sub


    Olaf Helper ----------- * cogito ergo sum * errare humanum est * quote erat demonstrandum * Wenn ich denke, ist das ein Fehler und das beweise ich täglich http://olafhelper.over-blog.de
    Freitag, 22. Januar 2010 15:06

Alle Antworten

  • Hello Simon,

    If I execute the following code, I get a valid appointment in Outlook without any manual action.

    Some remarks.
    - Set "Option Explict": You set myAppointment to nothing, but your variable name is myMeeting
    - Better use early binding instead of late binding.

    Option Explicit

     

        Sub SetMeeting()

            Dim myOutlook As Outlook.Application

            Dim myMeeting As AppointmentItem

     

            myOutlook = CreateObject("outlook.application")

            myMeeting = myOutlook.CreateItem(olAppointmentItem)

     

            With myMeeting

                .MeetingStatus = olMeeting

                .RequiredAttendees = "user1@dummy.de;user2@dummy.de"

                .Subject = "TEST Meeting"

                .Start = Now()

                .End = Now() + 1

                .ReminderMinutesBeforeStart = 10

     

                .Display()

            End With

     

            myMeeting = Nothing

            myOutlook = Nothing

        End Sub


    Olaf Helper ----------- * cogito ergo sum * errare humanum est * quote erat demonstrandum * Wenn ich denke, ist das ein Fehler und das beweise ich täglich http://olafhelper.over-blog.de
    Freitag, 22. Januar 2010 15:06
  • Hallo Simon,

    Hat Dir die Antwort geholfen?

    Grüße,
    Robert

    Mittwoch, 27. Januar 2010 16:18
    Moderator
  • Hallo Simon,

    Ich gehe davon aus, dass die Antwort Dir weitergeholfen hat.
    Solltest Du noch "Rückfragen" dazu haben, so gib uns bitte Bescheid.

    Grüße,
    Robert

    Montag, 8. Februar 2010 11:39
    Moderator