Using this sub routine to open an Excel file. File is currently linked to a table in my database. Changing this so that the table is not linked, but would be updated by importing the Excel file into the table instead. On control button click, I want to open the Excel file, then when Excel is closed have file import into the table.

Private Sub Command2_Click()

' Set Daily Slope Button

' Late Binding (Needs no reference set)
Dim oXL As Object
Dim oExcel As Object
Dim sFullPath As String
Dim sPath As String




' Create a new Excel instance
Set oXL = CreateObject("Excel.Application")


' Full path of excel file to open
On Error GoTo ErrHandle
sFullPath = "C:\Documents and Settings\bruce\Desktop\Replenishment Program\Daily Slope.xlsx"


' Open it
With oXL
.Visible = True
.Workbooks.Open (sFullPath)
End With


ErrExit:
Set oXL = Nothing
Exit Sub

ErrHandle:
oXL.Visible = False
MsgBox Err.Description
GoTo ErrExit
End Sub