Appointments

Status
Not open for further replies.

Chrystel

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2013
Having trouble using macro given for creating appointments from Excel spreadsheet data.
I have copied and pasted the macro below yet keep getting error message "Use-defined type not defined":

Option Explicit
Public Sub CreateOutlookApptz()
Sheets("Sheet1").Select
On Error GoTo Err_Execute

Dim olApp As Outlook.Application
Dim olAppt As Outlook.AppointmentItem
Dim blnCreated As Boolean
Dim olNs As Outlook.Namespace
Dim CalFolder As Outlook.MAPIFolder
Dim subFolder As Outlook.MAPIFolder
Dim arrCal As String

Dim i As Long

On Error Resume Next
Set olApp = Outlook.Application

If olApp Is Nothing Then
Set olApp = Outlook.Application
blnCreated = True
Err.Clear
Else
blnCreated = False
End If

On Error GoTo 0

Set olNs = olApp.GetNamespace("MAPI")
Set CalFolder = olNs.GetDefaultFolder(olFolderCalendar)

i = 2
Do Until Trim(Cells(i, 1).Value) = ""
arrCal = Cells(i, 1).Value
Set subFolder = CalFolder.Folders(arrCal)

Set olAppt = subFolder.Items.Add(olAppointmentItem)

'MsgBox subFolder, vbOKCancel, "Folder Name"

With olAppt

'Define calendar item properties
.Start = Cells(i, 6) + Cells(i, 7) '+ TimeValue("9:00:00")
.End = Cells(i, 8) + Cells(i, 9) '+TimeValue("10:00:00")
.Subject = Cells(i, 2)
.Location = Cells(i, 3)
.Body = Cells(i, 4)
.BusyStatus = olBusy
.ReminderMinutesBeforeStart = Cells(i, 10)
.ReminderSet = True
.Categories = Cells(i, 5)
.Save

End With

i = i + 1
Loop
Set olAppt = Nothing
Set olApp = Nothing

Exit Sub

Err_Execute:
MsgBox "An error occurred - Exporting items to Calendar."

End Sub

Anyone have any ideas?
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A Outlook 365 New Appointments All saved to a 365 default calendar on Mac Using Outlook 0
M New Calendar Appointments: Conditionally turn off reminder and show time as free Using Outlook 5
Kika Melo Outlook Calendar deleted appointments not in Deleted Items folder Using Outlook 3
e_a_g_l_e_p_i Outlook 2021 all appointments not showing in calendar Using Outlook 2
S Changing colors of today's appointments, but not recurring ones Using Outlook 33
M Printing Appointments Using Outlook 1
M Calendar daily Appointments and printing Using Outlook 0
C Add Form to Appointments Received, Automatically Outlook VBA and Custom Forms 6
L Option to Show Cancelled Appointments Using Outlook 0
O Export Outlook calendar appointments by filters and date range Outlook VBA and Custom Forms 1
R Outlook 2007 only loads some appointments Using Outlook 0
N Gathering Calendar Appointments from Calendars that synced as Contacts Exchange Server Administration 1
F Year-and-a-day recurring appointments Using Outlook 1
J what file contains contacts, tasks and appointments stored locally? Using Outlook 1
D hiding appointments that are completed or cancelled, how to ? Using Outlook 5
M warning for too many appointments on a same day in Outlook Using Outlook 1
V importing appointments to non-default calendar? Using Outlook 1
OutlookIntegrator Appointments Using Outlook 0
R Make past appointments remain in calendar Using Outlook 1
M Creating Outlook Appointments from Excel Cells Outlook VBA and Custom Forms 1
A Outlook.com changing appointments Using Outlook 8
T populate calendar with appointments and send reminders Using Outlook 1
Diane Poremsky Copy New Appointments to Another Calendar using VBA Using Outlook 0
Diane Poremsky Create Appointments Using Spreadsheet Data Using Outlook 0
Diane Poremsky How to Import Appointments into a Group Calendar Using Outlook 0
I Outlook 2013 Appointments not in HTML Using Outlook.com accounts in Outlook 2
makinmyway Appointments Created in iCloud Calendars Cover Contacts Field...Why? Using Outlook 3
M Expected behaviour of recurring appointments? Using Outlook 2
C Find all deleted recurrence appointments Outlook VBA and Custom Forms 4
M Copy new appointments created in multiple shared calendars to another exchange calendar Outlook VBA and Custom Forms 1
R Outlook calendar appointments Free/Busy time is changing from "Busy" to "Free" Using Outlook 2
G Outlook does not show new appointments in To-Do-Bar Using Outlook 0
A Looping appointments in calendar Outlook VBA and Custom Forms 0
B Outlook Calendar/setting appointments Using Outlook 1
L Appointments disappearing Using Outlook 0
N To do bar - show more than 30 days of appointments Using Outlook 0
A Show ALL of today's appointments in To-Do Bar Using Outlook 1
F Outlook 2007 Calendar Appointments not in Outlook Today view Using Outlook 11
A Can't stop Outlook.com from setting reminders on appointments? Using Outlook.com accounts in Outlook 3
S Outlook 2013 Appointments missing Using Outlook 1
N Outlook Shared appointments automatically to Private Calendar Using Outlook 1
A Synchronize Access Table with Outlook Calendar Appointments Outlook VBA and Custom Forms 3
J Change reminder times of future appointments Using Outlook 1
Mark Rideout Search folder for appointments and emails Using Outlook 2
C Appointments from Excel to Outlook Using Outlook 3
C Appointments Using Outlook 25
I Adding appointments/tasks to other user's calendar Using Outlook 1
R Getting a colleagues appointments and calendar entries Using Outlook 1
N Outlook 2010 Archived Appointments Missing Using Outlook 5
Katrina Fox Missing appointments on calendar even though transferred from old pst Using Outlook 0

Similar threads

Back
Top