Note that there are some explanatory texts on larger screens.

plurals
  1. POOutlook 2003/VBA Movin E-Mails without changing the date
    primarykey
    data
    text
    <p>I use a macro in outlook 2003 to move selected emails to a specific folder. The moving works, but unfortunately the received date is overwritten to the current time. Any idea on how to prevent this.</p> <p>I use this code:</p> <pre><code>Sub verschiebenInOrdner() On Error Resume Next Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem Set objNS = Application.GetNamespace("MAPI") Set objInbox = objNS.GetDefaultFolder(olFolderInbox) Set objFolder = objNS.Folders.Item("2009").Folders.Item("In") If objFolder Is Nothing Then MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER" End If If Application.ActiveExplorer.Selection.Count = 0 Then Exit Sub End If For Each objItem In Application.ActiveExplorer.Selection If objFolder.DefaultItemType = olMailItem Then If objItem.Class = olMail Then objItem.UnRead = False objItem.Move objFolder End If End If Next Set objItem = Nothing Set objFolder = Nothing Set objInbox = Nothing Set objNS = Nothing End Sub </code></pre> <p>Thanks to the help of 76mel I came up with this:</p> <pre><code> Sub verschiebenInArchiv() Dim Session As Redemption.rDOSession Dim objFolder As Redemption.RDOFolder Dim objItem As Outlook.MailItem Dim objItem2 As Redemption.RDOMail Set Session = CreateObject("Redemption.RDOSession") Session.Logon Set objFolder = Session.Stores.Item("2009").IPMRootFolder.Folders("In") If Application.ActiveExplorer.Selection.Count = 0 Then Exit Sub End If For Each objItem In Application.ActiveExplorer.Selection Set objItem2 = Session.GetMessageFromID(objItem.EntryID, Session.Stores.DefaultStore.EntryID) objItem2.Move objFolder Next End Sub </code></pre> <p>This works when I am in my Inbox. Does anybody know how I can set the Store-ID in GetMessageFromID to the ID of the store in which my selection is made?</p> <p>Edit: Thanks 76mel, I am using objItem.Parent.StoreID now to get the current StoreID.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload