OutLook VBA Problem

RompStar

Well-known Member
Joined
Mar 25, 2005
Messages
1,200
I took over this process from someone that scans the INBOX in my Outlook and picks up certain email and puts them into a Log. For a while it worked, now I got this error, not sure why all of a sudden I am getting the error, it is:

" Run-time error '-2147352567 (80020009)':

Array index out of bounds. "

and idea ?

When I step through this code, the error pops up at the line:

Set myinboxfolder = myInbox.Folders(3)



Thanks!







Sub ExportAll()

' copies every messages from the IN Box

Dim Message As MailItem

Set myNameSpace = Application.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myinboxfolder = myInbox.Folders(3)

For Each Message In myinboxfolder.Items
Message.Categories = "Job"
Message.Save
Next Message

End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I figured it out, somehow my Rules were reset, I had to add the rules and now it works.
 
Upvote 0

Forum statistics

Threads
1,225,407
Messages
6,184,823
Members
453,262
Latest member
tifra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top