How to handle selection As Outlook.Selection getting error

Add-in Express™ Support Service
That's what is more important than anything else

How to handle selection As Outlook.Selection getting error
The Explorer has been closed and cannot be used for further operations 
Matt Driver


Matt


Posts: 152
Joined: 2004-08-17
Hi

In the ExplorerSelectionChange event I am doing the following:

Dim selection As Outlook.Selection = Nothing
selection = explorer.Selection.GetType


Randomly my users get the error:

"The Explorer has been closed and cannot be used for further operations"

How can I handle this better I was thinking of:


Dim selection As Outlook.Selection = Nothing
Try
selection = explorer.Selection
Catch
Exit Sub
End Try


Would this catch this issue and cleanly exit out of the event? or would I still get the Microsoft dialog box appear.

I had the same issue a while back getting the selection.item(1) but the following code fixed this issue can I apply this as above?

Try
object_ = selection.Item(1)
Catch
Exit Sub
End Try


Thanks

Matt
Posted 27 Oct, 2005 06:49:56 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi, Matt.

Yes, certainly. You can apply this code to the Selection object. It should help. I use the same code when I work with the Selection in Outlook.
Posted 27 Oct, 2005 08:49:10 Top