Not: Dim rs As Recordset2 '25.12.2019
satır hata verirse Recordset olarak değiştirin
bir de; "Tablo1" 3 ten fazla kayıt olursa "Ornek.xlsx" dosyasında ona göre Sayfa sayısı olması lazım yoksa hata alırsınız.
Dim xl As Excel.Application
Dim xlwkbk As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Dim rs As Recordset2 '25.12.2019
If Me.Dirty Then
DoCmd.RunCommand acCmdSaveRecord
End If
Set xl = New Excel.Application
Set xlwkbk = xl.Workbooks.Open(CurrentProject.Path & "\Ornek.xlsx")
SayfaSayi = 0 '25.12.2019
Set rs = CurrentDb.OpenRecordset("SELECT Tablo1.Kimlik, Tablo1.soyada, Tablo1.adi FROM Tablo1 ORDER BY Tablo1.Kimlik;") '25.12.2019
rs.MoveFirst '25.12.2019
While Not rs.EOF '25.12.2019
SayfaSayi = SayfaSayi + 1 '25.12.2019
xl.Sheets("Sayfa" & SayfaSayi).Select
With xlsheet
xl.Range("A1") = rs!soyada
xl.Range("B1") = rs!adi
End With
rs.MoveNext '25.12.2019
Wend '25.12.2019
rs.Close '25.12.2019
xl.Visible = True
Set MyRecordset = Nothing
Set xl = Nothing
Set xlwkbk = Nothing
Set xlsheet = Nothing