A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Archiving Emails



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 14th 07, 02:47 AM posted to microsoft.public.outlook.program_vba
Mark Ivey
external usenet poster
 
Posts: 15
Default Archiving Emails

Is there a way to move all messages in my inbox to my personal archive
folder into a subfolder with the email name that each email is from (if it
doesn't already exist).\

I am pretty proficient with VBA in MS Excel and have dabbled with VBScript,
therefore I may need some basic instructions on how to put this final
package together as well.

TIA for any help...

Mark Ivey


  #2  
Old May 23rd 07, 07:01 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Archiving Emails



Do you want to move the messages into an Outlook folder or the file system?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6

Am Sun, 13 May 2007 19:47:36 -0500 schrieb Mark Ivey:

Is there a way to move all messages in my inbox to my personal archive
folder into a subfolder with the email name that each email is from (if it
doesn't already exist).\

I am pretty proficient with VBA in MS Excel and have dabbled with

VBScript,
therefore I may need some basic instructions on how to put this final
package together as well.

TIA for any help...

Mark Ivey

  #3  
Old May 25th 07, 03:34 PM posted to microsoft.public.outlook.program_vba
Mark Ivey
external usenet poster
 
Posts: 15
Default Archiving Emails

Michael,

Thanks for your reply...

I actually got my answer in another thread:

Here is my finished product if anyone was interested:
__________________________________________________ ________________________________
Special thanks to: Eric Legault, Steven Harvey, and Sue Mosher for helping
derive the version posted below.
__________________________________________________ ________________________________
Sub ArchiveToFolder()
On Error Resume Next

Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
Dim myFolder As String

myFolder = Format(Date, "yyyy") ' My personal folder is labeled as the
current year (ie - '2007')

Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objNS.Folders(myFolder)

If Application.ActiveExplorer.Selection.Count = 0 Then
'Require that this procedure be called only when a message is
selected
Exit Sub
End If

For Each objItem In Application.ActiveExplorer.Selection

If FolderExist(objItem.SenderName) = False Then
objFolder.Folders.Add (objItem.SenderName)
End If

Set objFolder = objNS.Folders(myFolder).Folders(objItem.SenderName )

If objFolder.DefaultItemType = olMailItem Then
If objItem.Class = olMail Then
objItem.Move objFolder
Set objFolder = objNS.Folders(myFolder)
End If
End If
Next

Set objItem = Nothing
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing

End Sub

Function FolderExist(sFileName As String) As Boolean
FolderExist = IIf(Dir(sFileName, vbDirectory) "", True, False)
End Function
__________________________________________________ ________________________________


Mark Ivey

"Michael Bauer [MVP - Outlook]" wrote in message
.. .


Do you want to move the messages into an Outlook folder or the file
system?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:

http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6

Am Sun, 13 May 2007 19:47:36 -0500 schrieb Mark Ivey:

Is there a way to move all messages in my inbox to my personal archive
folder into a subfolder with the email name that each email is from (if
it
doesn't already exist).\

I am pretty proficient with VBA in MS Excel and have dabbled with

VBScript,
therefore I may need some basic instructions on how to put this final
package together as well.

TIA for any help...

Mark Ivey



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
protecting specific designated emails from auto-archiving/deleting Barry Outlook - General Queries 4 October 25th 07 02:20 AM
Backup and archiving emails? ***** charles Outlook Express 4 January 25th 07 10:14 PM
archiving emails simultaneously nan Outlook - General Queries 1 December 21st 06 11:14 AM
linked emails after archiving Tricky7 Outlook - Using Contacts 3 December 9th 06 12:34 AM
Auto-Archiving of employee´s emails - solution needed Uli Add-ins for Outlook 0 August 6th 06 06:38 PM


All times are GMT +1. The time now is 11:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.