Hey there,
I use the following vba code to export a string to an excel file. it is 25K rows and takes approx 20min. is there anyway to alter the code to speed this up?
I use the following vba code to export a string to an excel file. it is 25K rows and takes approx 20min. is there anyway to alter the code to speed this up?
Code:
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset(strExport, dbOpenDynaset, dbReadOnly)
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
If blnHeaderRow = True Then
For lngColumn = 0 To rst.Fields.Count - 1
xlc.Offset(0, lngColumn).Value = rst.Fields(lngColumn).Name
Next lngColumn
Set xlc = xlc.Offset(1, 0)
End If
'write data to worksheet
xlc.CopyFromRecordset rst
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing