        StrSor = "D:\DAILY_BOOKING.xls"    'ģ·ļ

    Dim xlApp As Excel.Application                                  'ExcelӦó
    Dim xlBook As Excel.Workbook                                    'Excel
    Dim xlSheet As Excel.Worksheet                                  'Excel
    Dim dbs As Database, strSQL As String, x As Integer
    Dim qdf As QueryDef
    Dim TableA As Variant, wks As Workspace
    Set dbs = CurrentDb()

    Set wks = Workspaces(0)
         Set TableA = dbs.OpenRecordset("bkg_CARGO_booking_cx_ܼ", dbOpenSnapshot)    'ָݿа׼ݵıѯ



Do While TableA.EOF <> True  'ѭһֱָıѯ¼βΪֹ

        StrDtn = "D:\BOOKING\" & TableA!VESSEL_NAME & " " & TableA!VOY & "_" & TableA!CARRIER_TRADE & "(" & Format(Date, "YYYYMMDD") & ").xls"   'ĿļָɵEXCEL·ԼļһݶΪ˸ļ֣ʡԣֱָһ־ͺá"d:\abc.xls"
        FileCopy StrSor, StrDtn                           'ԴļĿļ
    Set xlApp = CreateObject("Excel.Application")         'ExcelӦó
    Set xlApp = New Excel.Application
        xlApp.Visible = True                              'ĿɼΪ桱


    Set xlBook = xlApp.Workbooks.Open(StrDtn)
    Set xlSheet = xlBook.Worksheets(1)                    'ѡSheet1




x = 10
vsl_id = TableA!VESSEL_NAME  'һvsl_idΪжֶεǷ仯磺ǽֵҪѧУʦͳƣÿѧУһűʱһѧУΪֶΣҰݱѧУ򣬵ѧУûб仯ҾͬһEXCELУѧУˣҾдһEXCELС
voy_id = TableA!VOY  'ϸֶֶֻͬж϶ѡ
       
        Do While TableA.EOF <> True And TableA!VESSEL_NAME = vsl_id And TableA!VOY = voy_id  'ѭжݱûβĳֶεֵû仯
                xlSheet.Cells(6, 2) = TableA!VESSEL_NAME   'EXCELе6СڶеֶεݱеVESSEL_NAMEֶΡ
                xlSheet.Cells(6, 9) = TableA!VOY
                xlSheet.Cells(6, 18) = TableA!ETD
      
                
                xlSheet.Cells(x, 1) = TableA!۴
                xlSheet.Cells(x, 2) = TableA![L_20'GP]   
                xlSheet.Cells(x, 3) = TableA![L_40'GP]
                xlSheet.Cells(x, 4) = TableA![L_40'HC]  'EXCELеXУXǱ4еֶεݱеL_40'HCֶ
                xlSheet.Cells(x, 5) = TableA![L_45'HC]
                xlSheet.Cells(x, 6) = TableA![L_20'RF]
                xlSheet.Cells(x, 7) = TableA![L_40'RH]
                xlSheet.Cells(x, 9) = TableA![L] / 1000

                xlSheet.Cells(x, 10) = TableA![T_20'GP]
                xlSheet.Cells(x, 11) = TableA![T_40'GP]
                xlSheet.Cells(x, 12) = TableA![T_40'HC]
                xlSheet.Cells(x, 13) = TableA![T_45'HC]
                xlSheet.Cells(x, 14) = TableA![T_20'RF]
                xlSheet.Cells(x, 15) = TableA![T_40'RH]
                xlSheet.Cells(x, 17) = TableA![T] / 1000

                x = x + 1
                TableA.MoveNext
                      If TableA.EOF = True Then
                Exit Do
                End If
          
            Loop
                
                'dbs.Close
                xlBook.Save
                xlApp.Quit
                Set xlApp = Nothing


Loop   'ѭ





MsgBox "ϣD:\BOOKING\"