• Announcements

    • Reminder - MoDaCo position on illegal content   07/30/15

      ILLEGAL CONTENT I'd like to just reaffirm MoDaCo's position regarding piracy and illegal content in the light of some recent questions / postings. Posts will be censored by myself or my moderation team if the contain or link to: Illegal / pirated / cracked software or sites that host such softwareNintendo emulators / ROMs or sites hosting them (in light of Nintendo's legal stance)CUSTOM ROMS You may discuss and post links to custom device ROMs on MoDaCo, provided the following rules are adhered to: ROMs must not contain any illegal 3rd party software (this includes trial versions included without permission)ROMs must give full credit to the original authorISSUES If you have any issues with this policy, please contact PaulOBrien directly via PM.
    • Reminder: Selling items on the forum directly is not allowed   07/30/15

      Please note that selling items on the forum directly is not allowed by the forum rules. There is a forum for eBay auctions whereby you can list the items on eBay and link to them there. This is the ONLY forum for this type of activity. You may also advertise links to the eBay forum in your signature. Please note that selling directly in contravention of these rules will result in a warning / suspension / ban.

Outlook MACROs: Contact Birthdays and Private Appointments (VBA Code)

4 posts in this topic

Posted (edited)

You may find this useful if you:

- use Microsoft Outlook and synchronize your device with PC;

- birthdays in calendar have shifted in date, but birth date is OK in contact(s);

- use Microsoft Exchange, share your calendar and want birthdays to be set to Private;

- want to have birthday reminders other than at 23:45;

WARNING: Back up Outlook data file before using this solution. Use at your own risk.

Tested on MS Outlook 2007.

My solution is based on the solutions that can be found here:

http://www.outlookcode.com/d/code/remindbday.htm

http://the-trusted-adviser.spaces.live.com...C!513.entry

Thanks A LOT to the authors!

SOLUTION 1

You want Outlook to automatically set appointment to Private and reminder time to 22:00 when a new birthday event is added to calendar by Outlook.

DEFAULT BEHAVIOR:

- create contact or select existing contact

- go to details and set birth date

- save contact

* Appointment automatically created BUT not set to private and reminder time used as set in settings (Tools>Options>Default reminder) 15 minutes.

TARGET BEHAVIOUR:

- create contact or select existing contact

- go to details and set birth date

- save contact

* Appointment automatically created and set to PRIVATE with reminder 2 hours before birthday date (22:00).

Use code below as described here: http://www.outlookcode.com/d/code/remindbday.htm (my code is modified):

In Outlook, press Alt+F11 to open VBA window, then double-click "ThisOutlookSession" in the left pane and paste code. Then close VBA window. Done.

Dim WithEvents mcolCalItems As Items

Private Sub Application_MAPILogonComplete()
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set mcolCalItems = objNS.GetDefaultFolder(olFolderCalendar).Items
Set objNS = Nothing
End Sub

Private Sub mcolCalItems_ItemAdd(ByVal Item As Object)

If Item.Class = olAppointment And _
InStr(Item.Subject, "Birthday") > 0 Then
With Item
.ReminderSet = True
.ReminderMinutesBeforeStart = 120 'REMINDER TIME BEFORE DATE in MINUTES 120min = 2 hours
.Sensitivity = olPrivate 'THIS MAKES APPOINTMENT PRIVATE
.Save
End With
End If
End Sub[/codebox]

[b]SOLUTION 2[/b]

You want to batch re/create all (or selected) birthday items in Calendar based on info in Contacts.

Useful if you import contacts or have problems with birthdays (appear one day before) in calendar due to time zone change or DST.

Follow the link below for step by step solution, but use MY CODE:

http://the-trusted-adviser.spaces.live.com...p;wa=wsignin1.0

BEFORE RUNNING THE CODE: Create a subfolder in Outlook/Calendar folder and MOVE all recurring appointments (birthdays) to this new folder.

TIP: Use Tools > Organize > Using Views > Recurring appointments for easy filtering and multiple selection - Select desired contacts, press Alt+F8 run macro NewBirthdayReminder.

[codebox]Sub NewBirthdayReminder()

Dim objApp As Outlook.Application
Dim objNS As NameSpace
Dim objSelection As Outlook.Selection
Dim objItem As ContactItem

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")

Set objSelection = objApp.ActiveExplorer.Selection

MsgBox ("Converting " & objSelection.Count)

For Each objItem In objSelection

objItem.Birthday = objItem.Birthday

objItem.Save

Next

End Sub

SOLUTION 3

You want to batch process Appointments in Calendar to set REMINDER TIME or PRIVATE (sensitivity).

Useful if you use Microsoft Exchange and SHARE your calendar. You want your contacts' birthdays to be invisible to others.

Follow the link below for step by step solution, but use MY CODE:

http://the-trusted-adviser.spaces.live.com...p;wa=wsignin1.0

TIP: Use Tools > Organize > Using Views > Recurring appointments for easy filtering and multiple selection - Select desired contacts, press Alt+F8 run macro MarkAppointmentPrivate.

Sub MarkAppointmentPrivate()

Dim objApp As Outlook.Application
Dim objNS As NameSpace
Dim objSelection As Outlook.Selection
Dim objItem As AppointmentItem

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")

Set objSelection = objApp.ActiveExplorer.Selection

'Set mcolCalItems = objNS.GetDefaultFolder(olFolderCalendar).Items 'test

MsgBox ("Converting " & objSelection.Count)

For Each objItem In objSelection

With objItem
.ReminderSet = True
.Sensitivity = olPrivate 'THIS MAKES APPOINTMENT PRIVATE
.Save
End With

objItem.Save

Next

End Sub[/codebox]

[b]SOLUTION 4[/b]

You want to batch process Appointments in Calendar to set REMINDER TIME.

Useful if you want NEW reminder time to be set to all birthdays at once. If you do not like to wake up at 23:45 to snooze the reminder.

Follow the link below for step by step solution, but use MY CODE:

http://the-trusted-adviser.spaces.live.com...p;wa=wsignin1.0

TIP: Use Tools > Organize > Using Views > Recurring appointments for easy filtering and multiple selection - Select desired contacts, press Alt+F8 run macro MarkAppointmentTime.

[codebox]Sub MakeAppointmentTime()

Dim objApp As Outlook.Application
Dim objNS As NameSpace
Dim objSelection As Outlook.Selection
Dim objItem As AppointmentItem

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")

Set objSelection = objApp.ActiveExplorer.Selection

'Set mcolCalItems = objNS.GetDefaultFolder(olFolderCalendar).Items 'test

MsgBox ("Converting " & objSelection.Count)

For Each objItem In objSelection

With objItem
.ReminderSet = True
.ReminderMinutesBeforeStart = 120 'REMINDER TIME BEFORE DATE in MINUTES 120min = 2 hours
.Save
End With

objItem.Save

Next

End Sub

Thanks again to the authors of the original code.

GOOD LUCK

PS: Sorry for limited walkthrough and guiding, I have very little time but really wanted to post this solution.

Edited by madu
0

Share this post


Link to post
Share on other sites

Posted

Yeah, I like this stuff.

I keep meaning to "fix" the reminder time for birthdays to be something sensible - rather than midnight! I want to know a few days in advance, and at a reasonable time of day (just before lunch would be good so I can get a card/present)

Now you've reminded me I might just get around to doing it!

0

Share this post


Link to post
Share on other sites

Posted

In case you work by hours, replace the following line with new:

.ReminderMinutesBeforeStart = 120

replace to:

.ReminderMinutesBeforeStart = 60*XX

where XX is number of hours.

so if you want reminder at 12:00 two days before it should be

.ReminderMinutesBeforeStart = 60*36

0

Share this post


Link to post
Share on other sites

Posted

In case you work by hours, replace the following line with new:

.ReminderMinutesBeforeStart = 120

replace to:

.ReminderMinutesBeforeStart = 60*XX

where XX is number of hours.

so if you want reminder at 12:00 two days before it should be

.ReminderMinutesBeforeStart = 60*36

Would anyone have a script to change create birthdays from contacts but limit the recurrence to a specific number of time / number of annual events instead of having no end date?

Or just a script that can change recurring events with no end to to a specific number of time / number of events

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2015. MoDaCo uses IntelliTxt technology.