A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Macro to add calendar items from "birthday" field of imported cont



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 6th 06, 11:36 AM posted to microsoft.public.outlook.program_vba
Peter K.
external usenet poster
 
Posts: 3
Default Macro to add calendar items from "birthday" field of imported cont

Hello,
When you add a contact with a birthday, a calendar item will be
automatically added. This doesn't work for imported contacts. And I don't
want to manually re-enter the birthday for the tens of contacts with
birthday. Apparently (after some googling) this functionality doesn't exist
in Outlook 2002, and it should be done with a macro.

I found the following macro on a German site (see other post in this
discussion group), but I am not very confident that it will not screw up all
my contacts (the "mybirthday" and the "12.12.2000" make it seem to me that it
might replace all my carefully collected birthdays with the birthday of this
joker? But maybe I'm just too paranoiac and this works just fine). I don't
know anything from macro's, so can someone have a look and check this macro?

Thanks a lot.

Peter

--------------------------------------------------------------------------------

Sub BirthdayImport()

Dim myFolder As MAPIFolder
Set myFolder = Session.PickFolder
For i = myFolder.Items.Count To 1 Step -1
If myFolder.Items(i).Class = 40 Then
myFolder.Items(i).Display
mybirthday = myFolder.Items(i).Birthday
myFolder.Items(i).Birthday = "12.12.2000 "
myFolder.Items(i).Birthday = mybirthday
myFolder.Items(i).Save
myFolder.Items(i).Close 0
End If
Next i

End Sub

--------------------------------------------------------------------------------

Ads
  #2  
Old April 6th 06, 12:40 PM posted to microsoft.public.outlook.program_vba
Peter K.
external usenet poster
 
Posts: 3
Default Macro to add calendar items from "birthday" field of imported cont


Ok, I try to get some learning out of this as well. I understand most of the
code now, so I understand that the 12.12.2000 is just a temporary birthday
date before being changed with the original one again.
The only line of code that I can't figure out is this one:

If myFolder.Items(i).Class = 40

What is the meaning of this 40 ?

Peter


"Peter K." wrote:

Hello,
When you add a contact with a birthday, a calendar item will be
automatically added. This doesn't work for imported contacts. And I don't
want to manually re-enter the birthday for the tens of contacts with
birthday. Apparently (after some googling) this functionality doesn't exist
in Outlook 2002, and it should be done with a macro.

I found the following macro on a German site (see other post in this
discussion group), but I am not very confident that it will not screw up all
my contacts (the "mybirthday" and the "12.12.2000" make it seem to me that it
might replace all my carefully collected birthdays with the birthday of this
joker? But maybe I'm just too paranoiac and this works just fine). I don't
know anything from macro's, so can someone have a look and check this macro?

Thanks a lot.

Peter

--------------------------------------------------------------------------------

Sub BirthdayImport()

Dim myFolder As MAPIFolder
Set myFolder = Session.PickFolder
For i = myFolder.Items.Count To 1 Step -1
If myFolder.Items(i).Class = 40 Then
myFolder.Items(i).Display
mybirthday = myFolder.Items(i).Birthday
myFolder.Items(i).Birthday = "12.12.2000 "
myFolder.Items(i).Birthday = mybirthday
myFolder.Items(i).Save
myFolder.Items(i).Close 0
End If
Next i

End Sub

--------------------------------------------------------------------------------

  #3  
Old April 6th 06, 02:32 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Macro to add calendar items from "birthday" field of imported cont

The Object Browser is your friend.

Class uses the OlObjectClass enum. 40 = olContact. So the code is testing to
see if the item is a contact item.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Peter K." wrote in message
...

Ok, I try to get some learning out of this as well. I understand most of
the
code now, so I understand that the 12.12.2000 is just a temporary birthday
date before being changed with the original one again.
The only line of code that I can't figure out is this one:

If myFolder.Items(i).Class = 40

What is the meaning of this 40 ?

Peter


"Peter K." wrote:

Hello,
When you add a contact with a birthday, a calendar item will be
automatically added. This doesn't work for imported contacts. And I don't
want to manually re-enter the birthday for the tens of contacts with
birthday. Apparently (after some googling) this functionality doesn't
exist
in Outlook 2002, and it should be done with a macro.

I found the following macro on a German site (see other post in this
discussion group), but I am not very confident that it will not screw up
all
my contacts (the "mybirthday" and the "12.12.2000" make it seem to me
that it
might replace all my carefully collected birthdays with the birthday of
this
joker? But maybe I'm just too paranoiac and this works just fine). I
don't
know anything from macro's, so can someone have a look and check this
macro?

Thanks a lot.

Peter

--------------------------------------------------------------------------------

Sub BirthdayImport()

Dim myFolder As MAPIFolder
Set myFolder = Session.PickFolder
For i = myFolder.Items.Count To 1 Step -1
If myFolder.Items(i).Class = 40 Then
myFolder.Items(i).Display
mybirthday = myFolder.Items(i).Birthday
myFolder.Items(i).Birthday = "12.12.2000 "
myFolder.Items(i).Birthday = mybirthday
myFolder.Items(i).Save
myFolder.Items(i).Close 0
End If
Next i

End Sub

--------------------------------------------------------------------------------


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting calendar items should ask "all past and future items" katie Outlook - Calandaring 0 April 4th 06 03:52 AM
"Percent" field changed to "Number" field Vaughan Outlook - Using Forms 1 March 14th 06 01:32 PM
Shared Calendar items "automatically" added to personal Calendar? [email protected] Outlook - Calandaring 1 February 6th 06 06:01 PM
Where is "Categories" field in create new task window? How do I add it? [email protected] Outlook - Calandaring 1 February 1st 06 07:21 PM
macro for "from" field Roann Outlook and VBA 1 January 30th 06 06:41 AM


All times are GMT +1. The time now is 04:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.