I was using ADODB code in Windows to fetch data from Mysql Database and it was working fine. However, I can not seem to get my Excel workbook (using ADODB) to work with Excel Mac 2011. After a lot of googling, I found an ODBC connector from Actual tech and I was able to fetch three rows using Microsoft Query. But I want this to be done using VBA code but have been unable to do so. Has anyone gotten this to work? If yes, can you please provide me with a sample code. Thanks in Advance !!
P.S: I know there is a similar existing question but the link provided in the answer is no longer working. hence, I have asked a new question
Also, If anyone needs the link to do it through Microsoft Query, here is the link:Generate a report from a database
Here is the code I use in Windows:
<code> Sub getMysqlDBdata()
DimCnAsObject
Dim sqlQa asstring
dim temparray1 as variant
Source = 'MySQL'
mysql_driver = 'MySQL ODBC 5.2 ANSI Driver'
sqlQa = 'select * from homeunion.propertydata;'
SetCn = CreateObject('ADODB.Connection')
Set rs = CreateObject('ADODB.Recordset')
Cn.Open'Driver={MySQL ODBC 5.2 ANSI Driver };Server= 127.0.01 ;Database= test;UID= root ;PWD= 12345'
rs.Open sqlQa, Cn, adOpenStatic
temparray1 = rs.GetRows()
rs.Close
Set rs = Nothing
EndSub</code>
P.S: I know there is a similar existing question but the link provided in the answer is no longer working. hence, I have asked a new question
Also, If anyone needs the link to do it through Microsoft Query, here is the link:Generate a report from a database
Here is the code I use in Windows:
<code> Sub getMysqlDBdata()
DimCnAsObject
Dim sqlQa asstring
dim temparray1 as variant
Source = 'MySQL'
mysql_driver = 'MySQL ODBC 5.2 ANSI Driver'
sqlQa = 'select * from homeunion.propertydata;'
SetCn = CreateObject('ADODB.Connection')
Set rs = CreateObject('ADODB.Recordset')
Cn.Open'Driver={MySQL ODBC 5.2 ANSI Driver };Server= 127.0.01 ;Database= test;UID= root ;PWD= 12345'
rs.Open sqlQa, Cn, adOpenStatic
temparray1 = rs.GetRows()
rs.Close
Set rs = Nothing
EndSub</code>
![Excel For Mac 2011 Driver Excel For Mac 2011 Driver](https://support.content.office.net/en-us/media/97bb4d00-fb2f-40e4-8812-8fd94b16e1c6.png)
Refresh QueryTable throwing “General ODBC error” - VBA Excel 2011 for Mac. I am working in Excel 2011 on a Mac so be aware that not everything that works on.