![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hello
I have been using the below email for a while now; I just have to keep running it to bypass by error message but now I am receiving too many emails to keep doing this, Can someone please tell me how to resolve this run time error? Run time error '-2147352567 (80020009) Array index out of bounds My macro is Public Function StripChars(ByVal sStr) As String sStr = Replace(sStr, """", "") sStr = Replace(sStr, "'", "") sStr = Replace(sStr, ":", "") sStr = Replace(sStr, "/", "-") sStr = Replace(sStr, "\", "-") sStr = Replace(sStr, "?", "") StripChars = sStr End Function Sub CopyEmailMsg() Dim myApp As Application Dim myNS As NameSpace Dim myFolder As Object Dim myItems As Outlook.MailItem 'Dim oAttachments As Outlook.Attachments Set myApp = New Outlook.Application Set myNS = myApp.GetNamespace("MAPI") Set myFolder = myNS.GetDefaultFolder(olFolderInbox).Folders("Clie nt").Folders("Subclient") 'Set myItems = myFolder.Items Set myDestFolder = myFolder.Folders("Subclient1") For Count = 1 To myFolder.Items.Count Set myMail = myFolder.Items(Count) myMail.SaveAs "C:\emails\" & StripChars(myMail.Subject) & ".msg", olMSG myMail.Move myDestFolder Next Count MsgBox "The emails have been copied and saved" End Sub It does work but the only real problem is that I have to keep running it in order for it to process all the emails. I appreciate anyone's help with a revised code....I'm not an expert in this area, Thanks so much Andrea |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook Macro problem | Victor Delta | Outlook and VBA | 2 | December 9th 06 06:12 PM |
vba macro to print email and attachments outlook 2000 | Dan over in IT | Outlook and VBA | 2 | June 7th 06 08:08 PM |
Macro Problem | Guy | Outlook and VBA | 4 | May 18th 06 04:08 AM |
put macro into MS Outlook 2000 | David C | Outlook and VBA | 4 | January 25th 06 05:00 PM |
Outlook 2000 - Button to run Macro then open Database | David C | Outlook and VBA | 1 | January 25th 06 03:44 PM |