I don't know if you'd be interested, but you don't have to open a worbook to delete sheets from it. This would get rid of the stupid SendKeys command (I have a semi-irrational hatred of that command).
This example will open a workbook in C:Temp called "Book2.xls" it will then delete sheet2 from that workbook, assuming that sheet exists.<pre>
Public Sub main()
Dim XL As Excel.Application
Dim WBK As Excel.Workbook
On Error GoTo ERR_MAIN
Set XL = CreateObject("Excel.Application")
Set WBK = XL.Workbooks.Open("C:TempBook2.xls")
XL.DisplayAlerts = False
WBK.Sheets("Sheet2").Delete
XL.DisplayAlerts = True
ERR_MAIN:
WBK.Close savechanges:=True
Set XL = Nothing
End Sub</pre>
I hope this is of use.
EDIT:: Obviously there are too many backslashes in the path definition, but you can remove those. That's a known bug of this message board.
_________________<font color = green> Mark O'Brien
This message was edited by Mark O'Brien on 2002-04-05 13:32
This message was edited by Mark O'Brien on 2002-04-05 18:07