Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / December 2006

Tip: Looking for answers? Try searching our database.

Birthdays in calendar

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Twotone - 23 Dec 2006 18:15 GMT
I have a macro that I run periodically on a particular contacts folder to
change all the Last Names of the contacts in that folder to uppercase. The
code, shown below, seems to work fine, except that, every time I run it, it
creates an extra shortcut in my calendar for each of the contacts' birthdays.
I now have four shortcuts for each of about 200 contacts' birthdays.

Can anyone suggest
(a) How to modify my code to stop this happening in future
(b) A new macro to remove the redundant shortcuts in my calendar.

I am using Outlook 2003 (fully updated) on Windows XP Professional (fully
updated)

TIA Anthony

Sub PutLastNameInCaps()
'For phone contacts folder so they are easier to read on my phone

   Set myOlApp = CreateObject("Outlook.Application")
   Set myNameSpace = myOlApp.GetNamespace("MAPI")
   Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts)
   Set myNewFolder = myFolder.Folders("Phone contacts")

   For Each mycontact In myNewFolder.Items
       MyNewName = UCase(mycontact.LastName)
       mycontact.LastName = MyNewName
       mycontact.Save
   Next mycontact
   
End Sub
Peter Marchert - 24 Dec 2006 05:12 GMT
This "feature" is only supported in Outlook Version 2003.

You can try to use the following code to remove the birthday entry:

Public Sub RemoveBirthDay(ByVal strBirthDay As String, ByVal strName As
String)

   Dim objCalendar         As Outlook.AppointmentItem
   Dim strFind             As String

   strFind = "[Subject] = " & strName & Asc(39) & "s " &
"""Birthday"""""
   Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar).Items.Find(strFind)

   If Not objCalendar Is Nothing Then
       If objCalendar.Start = strBirthDay Then objCalendar.Delete
   End If

End Sub

If you have anniversaries in your contact you need to delete these too.

Best Regards
Peter

--
Peter Marchert
[EDP-Service Marchert]
Homepage: Http://Www.Marchert.De
Excel- And Outlook Programming

> I have a macro that I run periodically on a particular contacts folder to
> change all the Last Names of the contacts in that folder to uppercase. The
[quoted text clipped - 26 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.