I want to wrote a vb to get data from SQL Server to Excel. But when I run this, I get an compile error msg "Expected variable or procedure, not module" and direct to the MsgBox line. I not sure why this happen.
Sub SQLDatabase()
Dim rs As ADODB.Recordset ' hold data
Dim cnSQL As...