This would be the correct syntax: On Error Resume Next ' code to return some obj as an object variable If Not obj Is Nothing Then ' then you know obj exists End If
Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54
"Ed" <elandau1@gmail.com> wrote in message news:ef4bc400-3dae-4e1d-95d7-540183a7cd68@n19g2000prg.googlegroups.com...
> I'm writing VBA for Outlook 2007. I set an object to point to an > email Item in an explorer. > > If the item is moved or deleted, the object returns an error when I > try to access it. Is there a way to tell if the object still exists? > Something like: if (exists Object) then ?? > > I could just trap on the error but then the code start looking like > "Basic" with goto statement :). > > Thanks, > -Ed
19 Jun 2008Can I tell if an object exists?.Ed
19 Jun 2008\ Re: Can I tell if an object exists?.Sue Mosher [MVP-Outlook]
19 Jun 2008   \ Re: Can I tell if an object exists?.Ed
19 Jun 2008      \ Re: Can I tell if an object exists?.Ed
19 Jun 2008         \ Re: Can I tell if an object exists?.Sue Mosher [MVP-Outlook]
19 Jun 2008            \ Re: Can I tell if an object exists?.Ed
19 Jun 2008               \ Re: Can I tell if an object exists?.Sue Mosher [MVP-Outlook]
19 Jun 2008                  \ Re: Can I tell if an object exists?.Ed
19 Jun 2008                     \ Re: Can I tell if an object exists?.Sue Mosher [MVP-Outlook]
20 Jun 2008                        \ Re: Can I tell if an object exists?.Ed
20 Jun 2008                           |- Re: Can I tell if an object exists?.Stephen Griffin
20 Jun 2008                           |  \ Re: Can I tell if an object exists?.Ed
20 Jun 2008                           |     \ Re: Can I tell if an object exists?.Sue Mosher [MVP-Outlook]
20 Jun 2008                           |        \ Re: Can I tell if an object exists?.Ed
20 Jun 2008                           |           |- Re: Can I tell if an object exists?.Sue Mosher [MVP-Outlook]
23 Jun 2008                           |           \ Re: Can I tell if an object exists?.Ed
20 Jun 2008                           \ Re: Can I tell if an object exists?.Sue Mosher [MVP-Outlook]
All times are in (US) Eastern Daylight Time (GMT -4:00)