New Text Document
New Text Document
New Text Document
Connect.Open ConnString
RS.Open SqlQuery, Connect
Sheets("Source").UsedRange.ClearContents
Dim i As Integer
For i = 1 To RS.Fields.Count
Sheets("Source").Cells(1, i).Value = RS.Fields(i - 1).Name
Next
Sheets("Source").Range("A2").CopyFromRecordset RS
Sheets("Source").Select
Range("A1").Select
With tbl
.Name = "DATALIMS"
.Range.Columns.AutoFit
End With
RS.Close
Connect.Close
End Sub