Create calendar appointment in a specific account in vba RRS feed

  • Question

  • hello

    I am to use a code in visual basic 6.0 to create a calendar appointment, and modify and delete everything right,
    But it is in the default data file, outlook

    I tried to enter another account dating but I always saved in the default data file ..

    With this code I keep the calendar appointment, I changed the container I want and nothing, I still saved to the default ..

    Private Function CreateAppointment(SubjectStr As String, BodyStr As String, StartTime As Date, EndTime As Date, AllDay As Boolean, ubicacion As String)
        Dim olApp As Outlook.Application
        Dim Appt As Outlook.AppointmentItem
        ' Only create the reminder if there's no duplicate
    '    If (CheckForDuplicates(SubjectStr) = False) Then
            Set olApp = CreateObject("Outlook.Application")
            Set Appt = olApp.CreateItem(olAppointmentItem)
            Appt.Recipients.Add (Me.cmdCuenta.Text)
            Appt.Subject = SubjectStr
            Appt.Start = StartTime
            Appt.End = EndTime
            Appt.AllDayEvent = AllDay
            Appt.Location = ubicacion
            Appt.Body = BodyStr
            Appt.ReminderMinutesBeforeStart = EvaluarRecordatorio
            Appt.ReminderSet = True
    '    End If
        Set Appt = Nothing
        Set olApp = Nothing
    End Function

    Thursday, October 10, 2013 2:41 PM


  • The CreateItem() method always creates the item in the default folder for that type of item in your default Store. That cannot be changed.

    To get the item created where you want, either get the Folder you want the item created in and get its Items collection then call the Add() method, or call the Move() function on the item after it's created in the default folder to move it where you want.

    Ken Slovak MVP - Outlook

    Thursday, October 10, 2013 3:08 PM