title: ODBC connection in VBA on a mac (excel 2011) to a postgresql db
body: <p>I have a vba script in excel on a windows box that connects using ADO to a postgresql db.  I have to do the same on a mac.  From reading the posts on SO, I've:
  - downloaded an odbc driver (openlink) on to the mac
  - set up a DSN and successfully connected to the db</p>
  
  <p>now to the vba change.  I've searched on SO, postgresql.org site, openlinks and some other places for a clear example, but haven't found it yet.  Here is the relevant vba code on the windows:</p>
  
  <pre><code>Dim cnn As New ADODB.Connection
  Dim rst As New ADODB.Recordset
  Dim strSomeValue As String
  
  cnn.Open "DRIVER={PostgreSQL ANSI};DATABASE=&lt;db&gt;;SERVER=&lt;target&gt;;PORT=&lt;port&gt;;UID=&lt;myusername&gt;;PWD=&lt;mypwd&gt;"
  </code></pre>