Creating Parameterized SQL Queries in Excel 2010 with VBA
问题 I came across the following link: http://www.informit.com/guides/content.aspx?g=sqlserver&seqNum=135 In it, they list relatively simple code to query the SQL Database from Excel VBA. ' Declare the QueryTable object Dim qt As QueryTable ' Set up the SQL Statement sqlstring = "select au_fname, au_lname from authors" ' Set up the connection string, reference an ODBC connection ' There are several ways to do this ' Leave the name and password blank for NT authentication connstring = _ "ODBC;DSN