Set Appointment Settings Macro

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Set Appointment Settings Macro

Post by arroway »

Hello,
I'm hoping for help writing a Macro which will set Appointment attributes for me.

I'd like it to work like:
Select appointment
Hit Macro Button on ribbon (I know how to insert and assign this on the ribbon) which will:
Set the Show As: as Free
Set the Reminder to 0 minutes
Set the Categorize to a Category named Team Outs which is currently set to Light Grey

Can someone please help me with this?
Thank you!!
--Dax
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Set Appointment Settings Macro

Post by Rudi »

Try this code:

make sure the appointment is selected before you run the code...
Copy the code into the "ThisOutlookSession" module.

Code: Select all

Sub SetApp()
Dim objItem As Object
    Set objItem = GetCurrentItem
    If Not TypeOf objItem Is AppointmentItem Then
        MsgBox ("Not an appointment")
        Exit Sub
    End If
    With objItem
        .Categories = "Team Outs"
        .ReminderSet = False
        .BusyStatus = 0
        .Save
    End With
End Sub

Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
    Case "Explorer"
        Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
    Case "Inspector"
        Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
    Case Else
End Select
End Function
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
arroway
3StarLounger
Posts: 368
Joined: 04 Jan 2012, 22:43

Re: Set Appointment Settings Macro

Post by arroway »

SWEETNESS!!! I added it to the Quick Access Toolbar and it's a thing of beauty! I'm getting all emotional over here. Thank you so much!

:bananas: :clapping: :bananas: :clapping: :bananas: :clapping: :bananas: :clapping: :bananas: :clapping: :bananas: :clapping: :bananas: :clapping:
It takes 2 to tango; unless you speak binary; then it takes 10.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Set Appointment Settings Macro

Post by Rudi »

Glad its working...
I'll go and make myself a banana split with all those bananas... :yum:
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.