Option
Explicit
Sub
Valj_Mapp()
'© 2003
Alla rättigheter XL-Dennis
Dim
olApp
As
Outlook.Application
Dim
olNameSpace
As
Outlook.NameSpace
Dim
olFolder
As
Outlook.MAPIFolder
Dim
olNoteItem
As
Outlook.NoteItem
On
Error
GoTo
ExitSub
Set
olApp =
CreateObject("Outlook.Application")
Set
olNameSpace = olApp.GetNamespace("MAPI")
'Här
initieras dialogrutan för val av mapp.
ValjMapp:
Set
olFolder = olNameSpace.PickFolder
If
Not
olFolder
Is
Nothing
Then
'Här
kontrolleras om den valda mappen är av typen kom-ihåg-poster-mapp eller
inte.
'Defaultitemtype-värdet
för denna typ av mapp är 5.
If
olFolder.DefaultItemType <>
5
Then
MsgBox
"Den
valda mappen "
&
olFolder.Name
&
"
är inte av rätt mapptyp.",
vbInformation
GoTo
ValjMapp
Else
If
olFolder.Items.Count >
0
Then
For
Each
olNoteItem In olFolder.Items
Debug.Print olNoteItem.Subject
Next
olNoteItem
Else
MsgBox
"Den
valda mappen har inga kom-ihåg-poster.",
vbInformation
GoTo
ExitSub
End
If
End
If
End
If
ExitSub:
Set
olNoteItem =
Nothing
Set
olFolder =
Nothing
Set
olNameSpace =
Nothing
Set
olApp =
Nothing
End
Sub