Parth Bhatt
Parth Bhatt

Reputation: 19469

Connecting to MySQL through Excel by running a Macro

strSQL = "INSERT INTO [ODBC;DSN=DSNName;].NameOfMySQLTable (IndexCode,LastTradePrice) VALUES"

strSQL = strSQL & "Select F1,G1 As NameOfMySQLField FROM [Excel 8.0;DATABASE=" & strFile & ";HDR=NO;IMEX=1].[Sheet1$];"

This is the query I write in MS Excel's macro. I have a database on server where I want this values to get inserted.

What is to be written in place of [ODBC;DSN=DSNName;].NameOfMySQLTable and in place of NameOfMySQLField?

Upvotes: 1

Views: 9452

Answers (1)

Mohamed Saligh
Mohamed Saligh

Reputation: 12339

You can find something here useful:

http://www.heritage-tech.net/908/inserting-data-into-mysql-from-excel-using-vba/

Upvotes: 1

Related Questions