Creating a new "All Day Event" In Outlook Using Excel 2010

bloodmilksky

Board Regular
Joined
Feb 3, 2016
Messages
202
Hi Guys, I hope you are all well.

I was just wondering if anyone knows how to use VBA/Excel to Create a new all day event In A Specific Calendar in outlook. The name of the calendar would be "UK Customer Services Calendar" and The Date Range would be Defined in Cells A1 And A2. Any Help Or Guidance would be great.

many thanks and all the best

BMS ^_^
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi

Code:
' Excel module
Sub CustomCalendar()
Dim outapp As Object, newitem As AppointmentItem, f As Folder
Set outapp = CreateObject("Outlook.Application")
Set f = outapp.Session.GetDefaultFolder(olFolderCalendar).Folders("UK Calendar")
Set newitem = f.Items.Add(olAppointmentItem)
With newitem
    .AllDayEvent = True
    .Start = [a1]
    .End = [a2]
    .Subject = "Excel Seminar3"
    .Save
End With
End Sub
 
Upvote 0
Hi thank you for your help.

I am getting a compile error: user - defined type not defined on the below
Code:
, newitem As AppointmentItem
 
Upvote 0
Please follow the forum rules on cross-posting. Thank you.
 
Upvote 0
· Add this reference:VBE>Tools>References>Microsoft Outlook Object Library
· See if the code below displays the desired folder:


Code:
' Outlook module
Sub MyCalendars()
Dim f As Folder, subf As Folder
Set f = Application.Session.GetDefaultFolder(olFolderCalendar)
MsgBox f.Folders.Count & " folder(s) available"
For Each subf In f.Folders
    MsgBox subf.Name
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top