powerpoint vba to get data from SQL
I am using Powerpoint 2013. I have written the following VBA code from powerpoint which should automatically list a combobox based on the SQL query. But nothing is showing up when I execute. Can somebody help ?
Option Explicit
Code:
Private Sub ComboBox21_Change()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim cs As String
Dim query As String
Dim row As Integer
Set conn = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
cs = "Provider=SQLOLEDB;Data Source=ausitsmprd02trial.com;Initial Catalog=ServicesAnalysts;Integrated Security=SSPI;"
'parameters here are connectionSring, username, password
'you will need to put the actual username and password in
'quotes here for this code to work.
conn.Open cs
query = "select top 10 * from dbo.[DimPerson]"
rs.Open query, conn
row = 0
Do Until rs.EOF
Debug.Print rs.Fields("PersonName").Value
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
End Sub