View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] EagleOne@discussions.microsoft.com is offline
external usenet poster
 
Posts: 391
Default How to test success of a "Set" command?

Thanks Jim


Jim Thomlinson wrote:

Your code has me at a bit of a loss so here is a generallized method...

dim wbkOpen as workbook

on error resume next
set wbkOpen = workbooks("MyBook.xls")
on error goto 0

is wbkOpen is nothing then _
set wbkOpen = Workbooks.Open("C:\Mybook.xls")

'Note that Nothing is the test for an object being initialized