-
Notifications
You must be signed in to change notification settings - Fork 11
/
Outlook VBA - Create contact2.vb
70 lines (52 loc) · 1.7 KB
/
Outlook VBA - Create contact2.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
https://www.slipstick.com/developer/code-samples/create-appointment-email-automatically/
Sub add_NewContact()
Dim j As ContactItem
Set j = Outlook.CreateItem(olContactItem)
With j
.Title = "Miss"
.FirstName = "Leila"
.MiddleName = "Goory"
.LastName = "Lopez"
.Gender = olFemale
.CompanyName = "Google"
.JobTitle = "Directrice Marketing"
'.FileAs = "..."
.Email1Address = "leila@gmail.com"
.Email1AddressType = "Work"
.WebPage = "www.google.com"
.Anniversary = #3/10/1987#
'.AddPicture "..."
.Initials = "LL"
.BusinessAddress = "Loos"
.BusinessTelephoneNumber = "06 68 55 29 75"
.MobileTelephoneNumber = "06 68 55 29 75"
.MailingAddressStreet = "20 rue du Docteur Calmette"
.MailingAddressCity = "Lille"
.MailingAddressPostalCode = "59120"
.Body = "Notes"
'.Categories
.Display
End With
End Sub
Private Sub ListCategoryIDs()
Dim objNameSpace As NameSpace
Dim objCategory As Category
Dim strOutput As String
' Obtain a NameSpace object reference.
Set objNameSpace = Application.GetNamespace("MAPI")
' Check if the Categories collection for the Namespace
' contains one or more Category objects.
If objNameSpace.Categories.Count > 0 Then
' Enumerate the Categories collection.
For Each objCategory In objNameSpace.Categories
' Add the name and ID of the Category object to
' the output string.
strOutput = strOutput & objCategory.Name & ": " & objCategory.CategoryID & vbCrLf
Next
End If
' Display the output string.
MsgBox strOutput
' Clean up.
Set objCategory = Nothing
Set objNameSpace = Nothing
End Sub