| | Awarded by Microsoft since 2005: |  |
| | VBOffice Info | | Visitors | 1409334 | | Impressions | 5190026 |
| |
|
| |
| Author: Michael Bauer | Homepage | | Date: 07.02.2007 | Accessed: 17977 | | | | Description
We are very sorry! This description is not translated yet. Anyway, please try the code as it is self-explanatory. |
Private Const ARCHIVE_STOREID As String = ""
Private Const ARCHIVE_ENTRYID As String = ""
Public Function GetArchiveIDs() As Outlook.MAPIFolder
Dim Folder As Outlook.MAPIFolder
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Folder = Ns.PickFolder
If Not Folder Is Nothing Then
Set GetArchiveIDs = Folder
Debug.Print "ARCHIVE_STOREID: " & Folder.StoreID
Debug.Print "ARCHIVE_ENTRYID: " & Folder.EntryID
End If
End Function
Public Sub ArchivItems()
Dim SrcFolder As Outlook.MAPIFolder
Dim DestFolder As Outlook.MAPIFolder
Dim Items As Outlook.Items
Dim obj As Object
Dim Appt As Outlook.AppointmentItem
Dim Ns As Outlook.NameSpace
Dim DueDate As Date
Dim i&
Dim Counter&
Set Ns = Application.GetNamespace("MAPI")
Select Case 0
Case Len(ARCHIVE_STOREID), Len(ARCHIVE_ENTRYID)
Set DestFolder = GetArchiveIDs
If DestFolder Is Nothing Then
Exit Sub
End If
Case Else
Set DestFolder = Ns.GetFolderFromID(ARCHIVE_ENTRYID, ARCHIVE_STOREID)
End Select
DueDate = DateAdd("d", -1, Now)
Set SrcFolder = Ns.GetDefaultFolder(olFolderCalendar)
Set Items = SrcFolder.Items
For i = Items.Count To 1 Step -1
Set obj = Items(i)
If TypeOf obj Is Outlook.AppointmentItem Then
Set Appt = obj
If DateDiff("s", Appt.End, DueDate, vbUseSystemDayOfWeek, vbUseSystem) > 0 Then
Appt.Move DestFolder
Set Appt = Nothing
Counter = Counter + 1
End If
End If
Next
MsgBox "Es wurde(n) " & Counter & " Element(e) verschoben.", vbInformation
End Sub
|
| | |
| | |  | ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more] |
| | |  | Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more] |
| | |  | SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more] |
| | |  | OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more] |
| |
|