View Single Post
  #1  
Old March 21st 06, 03:59 PM posted to microsoft.public.outlook.program_vba
None
external usenet poster
 
Posts: 2
Default problem with flag icon

i'm not very expert on vba script. I'm using outlook 2003 and i'm
trying to do a simple application. Actually I'm receiving an error
using the script below.
The script try to access to the public folder "personale" where there
are a lot of mail.
it display correctly the selected mail (in this case the number 5 since
I wrote "Set mailnow = myfolder.Items(5)") but it can't compute the
last row of the code:

mailnow.FlagIcon = olGreenFlagIcon

giving me the error number 438 - Object doesn't support this property
or method.

Why can't i access to the property flag icon?

thanks for any help

bye!



Sub prova()
Set myfolder = GetPublicFolder("personale")


Set mailnow = myfolder.Items(5)

mailnow.Display

mailnow.FlagIcon = olGreenFlagIcon

End Sub

Public Function GetPublicFolder(strFolderPath)

Dim colFolders
Dim objFolder
Dim arrFolders
Dim i
On Error Resume Next
strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders = Split(strFolderPath, "\")

Set objFolder = Application.GetNamespace("MAPI")
Set objFolder = objFolder.Session.GetDefaultFolder(18)
Set objFolder = objFolder.Folders.Item(arrFolders(0))
If Not objFolder Is Nothing Then
For i = 1 To UBound(arrFolders)
Set colFolders = objFolder.Folders
Set objFolder = Nothing
Set objFolder = colFolders.Item(arrFolders(i))
If objFolder Is Nothing Then
Exit For
End If
Next
End If
Set GetPublicFolder = objFolder
Set colFolders = Nothing
Set objApp = Nothing
Set objFolder = Nothing
End Function

Ads