title: VBscript outlook form creating meeting in specific calendar
body: <p>I've been working on this the past few days. My VBscript code works and will create a meeting in the default calendar in Outlook. The part I can't seem to figure out is how to have the meeting made in a custom calendar named "Test". This calendar is listed under "My Calendars". Any advice?</p>
  
  <pre><code>Sub commandbutton1_Click()                                  
  
  If CommandButton1 = False Then
  
  Const olFolderCalendar = 9
  Const olAppointmentItem = 1
  Const olOutOfOffice = 3
  
  Set objOutlook = CreateObject("Outlook.Application")
  Set objNamespace = objOutlook.GetNamespace("MAPI")
  ' bottom line original:  Set objCalendar = objNamespace.GetDefaultFolder(olFolderCalendar) 
  
  Set objCalendar = objNamespace.GetDefaultFolder(olFolderCalendar) '.Parent.Items("Test")
  Set objApptItems = objCalendar.Items
  
  objApptItems.IncludeRecurrences = True
  objApptItems.Sort "[Start]"
  
  Set objHoliday = objOutlook.CreateItem(olAppointmentItem) 
                              'creating day off appointment
  objHoliday.Subject = "Boxing Day"
  objHoliday.Start = Item.UserProperties("DateText")
  objHoliday.End = Item.UserProperties("EndDate")
  objHoliday.AllDayEvent = True
  objHoliday.ReminderSet = False
  objHoliday.BusyStatus = olOutOfOffice
  objHoliday.Save
  
                              'testing confirmation email
  Set objMail = objOutlook.CreateItem(o)
      'Item.To
  objMail.to = Item.To    'UserProperties("From")
  objMail.Subject = "Confirmation: Requested Day(s) Off Approved"
  objMail.Body = "Congratulations, your requested day(s) off have been Approved!"
  objMail.Send
  
                              'closes email after hitting button
  'For i = objOutlook.Inspectors.count To 1 Step -1
  '        objOutlook.Inspectors.Item(i).Close True
  '    Next
  
  End If
  End Sub
  </code></pre>