How to COUNT and Get NAMEs Sheets using VBA in Access / Access içinde VBA kodu ile sayfa sayısı ve isimlerini alma
1- Excell Kitabı kapalı olmalı-must be closed
2- Access VBA module
Sub excelCountSheets_names() Dim lExcelObj As Excel.Application Dim lExcelWB As Excel.Workbook Dim lSheet As Excel.Worksheet Set lExcelObj = CreateObject("Excel.Application") Set lExcelWB = lExcelObj.Workbooks.Open(Application.CurrentProject.Path & "\testBook.xlsx") Set lSheet = lExcelWB.Sheets(1) Dim countSheets As Integer countSheets = lExcelWB.Sheets.Count For i = 1 To countSheets lSheet.Cells(i, 1).Value = lExcelWB.Sheets(i).Name Next lExcelWB.Save lExcelWB.Close lExcelObj.Quit Set lExcelWB = Nothing Set lExcelObj = Nothing End Sub
run excelCountSheets_names()
3- Excel Kitabı ve sonuç