Private Sub Command81_Click()
Dim xlApp As Object
Dim xlBook As Object
Dim xlSheet As Object
Dim sPathFile
Dim strSQL As String
Dim si
Set si = CreateObject("WScript.Network")
CurLog = si.UserName
sPathFile = "C:\Documents and Settings\" & CurLog & "\Desktop\FinanceDB\650.xls"
Set xlApp = CreateObject("Excel.Application") Set xlBook = xlApp.workbooks.Open(sPathFile)
Set xlSheet = xlBook.ActiveSheet
xlSheet.Columns("J:J").EntireColumn.Hidden = False
xlSheet.Range("J3").Select
fr = xlSheet.Cells(xlSheet.Rows.Count, 1).End(xlUp).Row
If fr > 3 Then
xlApp.Selection.AutoFill Destination:=xlSheet.Range(xlSheet.Cells(3, 10), xlSheet.Cells(fr, 10))
End If
xlSheet.Range(xlSheet.Cells(3, 10), xlSheet.Cells(fr, 10)).Select
xlSheet.Range("L23").Select
DoCmd.OpenQuery "Q_Del_650"
sAddr3 = xlBook.Sheets("Sheet1").Range(xlBook.Sheets("Sheet1").Cells(3, 1), xlBook.Sheets("Sheet1").Cells(fr, 11)).Address(False, False)
strSQL = "Insert INTO T_650 SELECT * FROM [Sheet1$" & sAddr3 & "] IN 'C:\Documents and Settings\" & CurLog & "\Desktop\FinanceDB\650.xls'[Excel 8.0;HDR=no;IMEX=2] ;"
CurrentDb.Execute strSQL ' ВОТ в этой строчке он открывает эксель
xlBook.Save
Set xlSheet = Nothing
Set xlBook = Nothing
xlApp.Quit
Set xlApp = Nothing
End Sub