export a form's record to excel

T

thread

hi all,
i need to export a form records to an excel for now i was able just to
export the first record
what do i need to cgange in order to loop all the records on the form:
Private Sub excel_Click()
Dim i As Integer
Dim xlApp As excel.Application
Dim xlWB As excel.Workbook
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWB = xlApp.Workbooks.Add ' create a new workbook
Set objActiveWkb = xlApp.Application.ActiveWorkbook
With objActiveWkb
If NumOfGroups > 2 Then
.Worksheets(1).Cells(3, 3) = Forms![modular form].group3
End If
If NumOfGroups > 3 Then
.Worksheets(1).Cells(4, 4) = Forms![modular form].group4
End If
If NumOfGroups > 4 Then
.Worksheets(1).Cells(5, 5) = Forms![modular form].group5
End If
If NumOfGroups > 5 Then
.Worksheets(1).Cells(6, 6) = Forms![modular form].group6
End If
If NumOfGroups > 6 Then
.Worksheets(1).Cells(7, 7) = Forms![modular form].group7
End If
End With


Set objActiveWkb = Nothing: Set xlApp = Nothing

End Sub
 
Top