I know absolutely nothing about using Outlook....is there a way to copy the contents of all email folders to a thumb drive?
A lady here at work tried to just copy the folders by selecting and copying, but the contents did not come with it in a format that can be read. There are hundreds of emails on a former employee's computer(he was fired this past Monday) here at work that we need to save.
EDIT: Domski's code worked great!
Last edited by jwright650; 03-31-2011 at 08:55 AM.
Life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
John Wright
I was going to adapt some code I'd written but this seems to do the job far better:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=875
Dom
"May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."
Use code tags when posting your VBA code: [code] Your code here [/code]
Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.
Thought would post my effort anyway, borrowing DRJ's function for stripping out the illegal characters:
Sub Save_All_Mail() Dim itm As Object Dim mFldr As Outlook.MAPIFolder Dim mlItm As Outlook.MailItem Dim strFileName As String ' Set mFldr = ThisOutlookSession.ActiveExplorer.CurrentFolder 'Use this to select current folder Set mFldr = ThisOutlookSession.Session.PickFolder 'Use this to let user pick folder If MsgBox("Are you sure you want to save all the emails from " & mFldr, vbYesNo) = vbNo Then GoTo End_Code For Each itm In mFldr.Items If itm.Class = olMail Then strFileName = Left(Format(itm.ReceivedTime, "yyyymmdd hhmmss") & " - " & itm.SenderName & " - " & _ StripIllegalChar(itm.Subject), 256) & ".msg" itm.SaveAs "C:\" & strFileName, olMSG End If Next itm End_Code: Set mFldr = Nothing End Sub Function StripIllegalChar(StrInput) Dim RegX As Object Set RegX = CreateObject("vbscript.regexp") RegX.Pattern = "[\" & Chr(34) & "\!\@\#\$\%\^\&\*\(\)\=\+\|\[\]\{\}\`\'\;\:\<\>\?\/\,]" RegX.IgnoreCase = True RegX.Global = True StripIllegalChar = RegX.Replace(StrInput, "") ExitFunction: Set RegX = Nothing End Function
Dom
Last edited by Domski; 03-31-2011 at 09:07 AM. Reason: File naming problem
"May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."
Use code tags when posting your VBA code: [code] Your code here [/code]
Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.
Thanks Dom...heading off to give this a try. Wish me luck....LOL
Life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
John Wright
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks