Oops, I dropped the declarations:
Option explicit
Private oXL as Object
Private oWB as Object
Private oWS as Object
Sub testme()
On Error Resume Next
Set oXL = GetObject(, "Excel.Application")
If Err Then
Set oXL = CreateObject("Excel.Application")
End If
oXL.Visible = True
Set oWB = oXL.workbooks.Add(1)
Set oWS = oXL.activesheet
'do stuff
oWB.Close savechanges:=False
oXL.Quit
Set oWS = Nothing
Set oWB = Nothing
Set oXL = Nothing
End Sub
<<snipped
--
Dave Peterson