T
Tobias Schröer
Hi group,
I have written a macro that loops the currently selected objects,
checks, if the object is a mail object and then does something with it.
Here's the code fragment:
Dim currentSelection As Selection
Dim mailObject As MailItem
' selected objects
Set currentSelection = Application.ActiveExplorer.Selection
' loop selection
For Each obj In currentSelection
' is mail?
If (obj.Class = olMail) Then
' get it
Set mailObject = obj
' do something
End If
Next
For most of the times its works perfectly. But then occassionally I get
an error when I try to work with a selection from another user's
postbox. The same thing was ok the day before and the day after it
worked again! Everything in between was a machine shutdown and startup.
I get a type error in the line "Set mailObject = obj". I have debugged
this and obj is an instance of MailItem.
I am completely lost here. Access rights to the postboxes have not
changed and I can see no further reasons. Does anyone have an idea how
to progress? I am using Outlook 2003 on a WinXP OS.
Thx,
Tobi
I have written a macro that loops the currently selected objects,
checks, if the object is a mail object and then does something with it.
Here's the code fragment:
Dim currentSelection As Selection
Dim mailObject As MailItem
' selected objects
Set currentSelection = Application.ActiveExplorer.Selection
' loop selection
For Each obj In currentSelection
' is mail?
If (obj.Class = olMail) Then
' get it
Set mailObject = obj
' do something
End If
Next
For most of the times its works perfectly. But then occassionally I get
an error when I try to work with a selection from another user's
postbox. The same thing was ok the day before and the day after it
worked again! Everything in between was a machine shutdown and startup.
I get a type error in the line "Set mailObject = obj". I have debugged
this and obj is an instance of MailItem.
I am completely lost here. Access rights to the postboxes have not
changed and I can see no further reasons. Does anyone have an idea how
to progress? I am using Outlook 2003 on a WinXP OS.
Thx,
Tobi