Problems with switch to 2007

  • Thread starter Thread starter QB
  • Start date Start date
Q

QB

I create a xls in 2003. It worked great!

We are now migrating to 2007, On my PC (once again) everything run smoothly.
But when others run it they get errors left right and center! I started
stepping through my code to try to resolve the problem(s) but am now more
confused then ever. For instance, I use the code below to delete a worksheet

Dim DstWkb As Workbook
Dim DstWks As String

Set DstWkb = ThisWorkbook
DstWks = "Project Info"

DstWkb.Worksheets(DstWks).Delete

and it generates an err.number = 9??? and yet it does delete the worksheet?!
Why does it work without issue for me and yet generate errors for others,
even though it works fine even for them (just reports errors)?

Thank you for your guidance,

QB
 
try looping thorugh each worksheet and check that the one you want to delete
exists and that the spelling is correct

dim ws as worksheet
for each ws in thisworkbook.worksheets
debug.print ws.name
next
 
Back
Top