

Password = "userpassword" ' Enter your password hereĬonn. User_id = "userid" ' enter your user ID here Server_name = "127.0.0.1" ' Enter your server name here - if running from a local computer use 127.0.0.1ĭatabase_name = "dbname" ' Enter your database name here See /downloads/connector/odbc/3.51.html or google "MySQL ODBC 3.51 Driver"ĭim sqlstr As String ' SQL to perform various actions ' 1)In VBE you need to go Tools/References and check Microsoft Active X Data Objects 2.x library ' PLEASE DO THE FOLLOWING BEFORE EXECUTING CODE: Firstly, you should see something like this: The next step is to click on the Connections link located right under the word Data in the tab list. In older versions of Excel, it’s a bit more of a process. For newer versions of Excel, click on Get Data, then From Other Sources, then From ODBC.
Odbc excel mysql code#
' Majority of the original code adapted from Carlmack Once you have opened Excel, click on the Data ribbon. ' VBA to perform various actions on MySQL tables using VBA Hope it saves others as much time as it would have saved me!
Odbc excel mysql install#
For example, if you want to analyse MySQL data in Excel, install the MySQL ODBC driver on the machine where Excel is installed. (Registration required.) Install and license the MySQL ODBC driver on the machine where your client application is installed. such as Microsoft Access or Excel or Borland Delphi. I haven't found anything like this on this site or any other so if this duplicates previous posts my apologies. Download the MySQL ODBC driver for your Windows platform. MySQL Connector/ODBC (sometimes called just Connector/ODBC or MyODBC) is a driver for connecting to a.

At the time this was written you specifically need the 2015 redistributable, and using the 2017 redistributable did not work. This code provides simple functionality using VBA to allow for the creation/deletion of MySQL tables and removing/adding records to tables. To set up a new ODBC data source for MySQL Server: Install the latest MySQL ODBC drivers: Download and install the Visual Studio C++ 2015 redistributable. Now select a data source you want to connect to, and click Next. In the opened dialog, you select ODBC DSN and click Next to continue. Click From Other Sources, and then click From Data Connection Wizard. Well after spending more time than I wish to admit I thought I would post some code that I adapted/created (thanks to Carlmack for core sections of the code). Connecting Excel to MySQL with Data Connection Wizard (Legacy Wizard) Start a new worksheet.
