View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default MIssing References

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