I am writing a macro for uploading data from the database directly to the sheet.
Sub Load_longer_period() Dim conn As ADODB.Connection Dim cmd As ADODB.Command Set conn = New ADODB.Connection Set cmd = New ADODB.Command login = ... pass = ... conn.open "Provider=OraOLEDB.Oracle.1;Password=" & pass & ";Persist Security Info=True;User ID=" & login & ";Data Source=..." conn.BeginTrans cmd.ActiveConnection = conn cmd.CommandText = "select * from test_table" Set rs = cmd.Execute ActiveWorkbook.Sheets("Договоры").Range("A1").CopyFromRecordset rs Set cmd = Nothing Set conn = Nothing Application.ScreenUpdating = True End Sub But this macro unloads the result without the name of the columns themselves, only the data itself. How to get more in addition and column names?