PDA

View Full Version : olFolder to a specific folder



orange
11-05-2010, 04:49 PM
Does anyone have sample code to show the correct syntax syntax to set olFolder to a specific folder? Not a olDefaultFolder, but suppose I had a folder
called "Keepers" under my "Personal Home Folders".

Constantly getting "Operation Failed. An object could not be found."

Set olFolder = olNameSpace.Folders("Keepers")

Thanks.

orange
11-06-2010, 07:06 AM
Bump.

I'm having difficulty with syntax. Does anyone have sample code that would show how to read the emails in a specific folder?

I would like to open a folder called "Keepers" using vba.

Thanks.

Crocus Crow
11-07-2010, 05:18 PM
Try:
Set olFolder = olNamespace.Folders("Personal Home Folders").Folders("Keepers")

orange
11-07-2010, 07:15 PM
Thanx CC
I got errors with your code and with some adjustments, got this to work



Sub crow()
Dim olnamespace As NameSpace
Dim olfolder As MAPIFolder
Set olfolder = Application.GetNamespace("MAPI").Folders("Personal Home Folders").Folders("Keepers")
olfolder.Display
End Sub