Just an update. I managed to figure out a basic connection to data transfer SQL Server contents into my Excel file with a Visual Basic Script!
Here's my code.
Code:
Sub Retrieve()
' Declare the QueryTable object
Dim qt As QueryTable
' Set up the SQL Statement
sqlstring = "select Column1, Column2 from TableName"
' Set up the connection string, reference an ODBC connection
connstring = _
"ODBC;DSN=servername;UID=id;PWD=pw;Database=dbname"
' Now implement the connection, run the query, and add
' the results to the spreadsheet starting at row A1
With ActiveSheet.QueryTables.Add(Connection:=connstring, Destination:=Range("A1"), Sql:=sqlstring)
.Refresh
End With
End Sub
Basically it takes the columns of the table [TableName] (column1 and column2) and inserts it into the Excel columns A1 and B1.
The next step is to find out how to use 3 excel columns as a "Key" in order to extract the correct data from the SQL Server database. Any help would be welcome, however I'll continue to update this thread regardless.