Ik ben bezig om een aantal templates voor Word op te zetten. mbv. Visual Basic wil ik als een gebruiker op een knop drukt dat de gegevens uit het adresboek gehaald worden. De volgende code heb ik maar de gegevens worden op de een of andere manier niet getoond:
code:
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
| Private Sub AddressButton_Click()
' Haal een adres op uit Exchange en stop deze in AdresBox
Style = ""
StyleFax = ""
StylePhone = ""
If StyleBox.Selected(0) = True Then
Style = Style & "<PR_COMPANY_NAME>" & vbCr
End If
If StyleBox.Selected(1) = True Then
Style = Style & "<PR_DISPLAY_NAME>" & vbCr
End If
If StyleBox.Selected(4) = True Then
Style = Style & "<PR_OFFICE_LOCATION>" & vbCr
End If
If StyleBox.Selected(2) = True Then
Style = Style & "<PR_STREET_ADDRESS>" & vbCr
End If
If StyleBox.Selected(3) = True Then
Style = Style & "<PR_POSTAL_CODE> <PR_LOCALITY> "
End If
If StyleBox.Selected(5) = True Then
Style = Style & "<PR_COUNTRY>"
End If
Style = Style & vbCr
If faxCheckBox.Value = True Then
StyleFax = "<PR_BUSINESS_FAX_NUMBER>"
Else
StyleFax = "<PR_HOME_FAX_NUMBER>"
End If
If PhoneCheckBox.Value = True Then
StylePhone = "<PR_OFFICE_TELEPHONE_NUMBER>"
Else
StylePhone = "<PR_HOME_TELEPHONE_NUMBER>"
End If
IPNAME = Application.GetAddress(Name, AddressProperties:="<PR_DISPLAY_NAME>", UseAutoText:=True, DisplaySelectDialog:=True)
IPNAME2 = Application.GetAddress(IPNAME, AddressProperties:=Style, UseAutoText:=False, DisplaySelectDialog:=False)
IPNAME3 = Application.GetAddress(IPNAME, AddressProperties:=StyleFax, UseAutoText:=False, DisplaySelectDialog:=False)
IPNAME4 = Application.GetAddress(IPNAME, AddressProperties:=StylePhone, UseAutoText:=False, DisplaySelectDialog:=False)
ToAddressBox.Text = IPNAME2
NumberBox.Text = IPNAME3
PhoneBox.Text = IPNAME4
End Sub |