Thread: Delete WB
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ronbo Ronbo is offline
external usenet poster
 
Posts: 162
Default Delete WB

I have two WorkBooks (in the same directory) open Test and TestX. From Test
I want to close and delete TestX. The code I am ussing is;

Sub Delete WB()
sName = ThisWorkbook.FullName
sName = Left(sName, Len(sName) - 4) & "X.xls"
Workbooks("sName").Close SaveChanges:=False
Kill "sName"
End Sub

It errors on the close statement. What am I doing wrong?

Thanks