본문 바로가기
카테고리 없음

[vba] Export Excel to Access

by IT HUB 2022. 9. 19.
728x90
반응형
Sub program1472()
    Dim acc As Object
    Set acc = CreateObject("Access.Application")
    acc.OpenCurrentDatabase ThisWorkbook.Path & "\DB.accdb"
    acc.DoCmd.TransferSpreadsheet _
            TransferType:=0, _
            SpreadSheetType:=acSpreadsheetTypeExcel12Xml, _
            TableName:="program1472", _
            Filename:=Application.ActiveWorkbook.FullName, _
            HasFieldNames:=True, _
            Range:="tem$A1:B10"
    acc.CloseCurrentDatabase
    acc.Quit
    Set acc = Nothing
End Sub
 
반응형


댓글