msoutlook.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

the received date changes when I use VBA move in outlook

 
Post new topic   Reply to topic    msoutlook.org Forum Index -> MS Office Outlook
Author Message
lars.plenge



Joined: 21 Feb 2008
Posts: 1

PostPosted: Thu Feb 21, 2008 8:16 am    Post subject: the received date changes when I use VBA move in outlook Reply with quote

I have created some buttons in outlook that moves emails to private
folders but the received date/time is changed to current date/time.

Can some help?



Sub buttons()
Public Function GetFolder(strFolderPath As String) As MAPIFolder
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.MAPIFolder
Dim arrFolders() As String
Dim I As Long
On Error Resume Next

strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders() = Split(strFolderPath, "\")
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.Folders.Item(arrFolders(0))
If Not objFolder Is Nothing Then
For I = 1 To UBound(arrFolders)
Set colFolders = objFolder.Folders
Set objFolder = Nothing
Set objFolder = colFolders.Item(arrFolders(I))
If objFolder Is Nothing Then
Exit For
End If
Next
End If

Set GetFolder = objFolder
Set colFolders = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Function
Sub ItemMove(DestFolder As String)
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myDestFolder As Outlook.MAPIFolder
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myDestFolder = GetFolder(DestFolder)
' If myDestFolder = Nothing Then
' MsgBox "Folder '" & DestFolder & "' could not be found", ,
"Folder Not found"
' Else
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
For x = 1 To myOlSel.Count
myOlSel.Item(x).Move myDestFolder
Next x
Set myNameSpace = Nothing
Set myDestFolder = Nothing
' End If
End Sub
Sub TCMMove()
Call ItemMove("Personal Folders/TCM")
End Sub

Sub PrivateMove()
Call ItemMove("Personal Folders Private/Privat")
End Sub

Archived from group: microsoft>public>office>developer>outlook>vba
Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Speed of VBA move vs manual move, for emails moved to Public Hi, I am writing a backup routine which will automatically file/move emails from the inbox of any of our staff, into Public Folders, using some simple rules. We have a team of remote workers, all using Outlook 2003 connected via VPN to Exchange. When test

Sending HTML in Outlook 2000 is received as plain text Hi, We have an application that uses VBA to control Outlook 2000. Outlook 2000 uses exchange server. When we manually create a mail message and send that message to both internal users (exchange sevrer) and external users (pop3) then all of them receive t

obtaining the currently highlighted date in the outlook cale Hello: is it possible to obtain using vba the currently highlighted date/date range within the outlook calendar? Also, is it posible to determine the current calendar view etc)? I am using outlook 2003 but if this works in 2007 that is a b

VBA Date Help Hello All, I was looking for some code where I start with current day and loop through 2 years of dates. Anyways I need to build up an array of dates. I am trying to find the 15th of each month and the last day of the month, also if the day of the week

Programmatically determine wheher I have received a meeting Hi, I am a delegate of my manager, which means I am getting all 'his' meeting requests in my inbox. However I am just a backup person, so therefore I am not the one who is usually accepting the requests. Is there any way to determine whether I have receiv
Post new topic   Reply to topic    msoutlook.org Forum Index -> MS Office Outlook All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group