0
VBA Access 2010을 사용하고 있습니다. 엑셀 파일에는 13 개의 워크 시트가 있으며 한 개의 워크 시트에서만 열을 가져와야합니다. 또한 열 머리글을 건너 뛰는 방법이 있으면 도움이됩니다. 고맙습니다. 당신이 시작하는 행 를 지정할 수 있습니다 범위를 정의하는이엑셀 파일에서 특정 워크 시트를 가져 오는 방법은 무엇입니까?
을 시도하고 액세스 빈을 건너 때문에 종료 행과 큰 머물 수
stat.Caption = "Import Files"
Me.Refresh
If txtFileSource.Value <> "" Then
Dim strTablename As String
Dim xlsRpt As New Excel.Application
Dim xbookRpt As New Excel.Workbook
Dim iRowCountRpt As Integer
Dim strRangeRpt As String
If cmbData.Value = "My File" Then
Set xbookRpt = Workbooks.Open(txtFileSource.Value)
iRowCountRpt = xbookRpt.Sheets(1).UsedRange.Rows.Count
strRangeRpt = "A1:I" & iRowCountRpt
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "tbl_Account", txtFileSource.Value, True, strRangeRpt
xbookRpt.Close
xlsRpt.Quit
End If
cmbData.Value = "Select File"
txtDestination.Value = ""
txtFileSource.Value = ""
Call DeleteImportErrorTables
Call MsgBox("Import successful!", vbInformation, "Import File")
End If
stat.Caption = "Ready..."
Me.Refresh