SqlQueryString = "SELECT * FROM SA"
Set rs = New ADODB.Recordset
rs.Open SqlQueryString, cnAccess, adOpenForwardOnly, adLockOptimistic
'Display Judul
Dim j As Integer
For j = 0 To rs.Fields.Count - 1
With Worksheets("Data2")
.Cells(1, j + 1) = rs.Fields(j).Name
.Cells(1, j + 1).Font.Bold = True
.Cells(1, j + 1).Interior.ColorIndex = 15
.Range("A2").CopyFromRecordset rs
.Columns("A:Z").AutoFit
End With
Next j
rs.Close
Set rs = Nothing
0 komentar:
Posting Komentar