title: Word-Macro: Oracle DB Connection
body: <p>I need a Word Macro, that connects to an Oracle-Dateabase, gets some information and puts it into my Document. </p>
  
  <p>Step one is to connect to the Database. I found the following code on <a href="http://dbaforums.org/oracle/index.php?showtopic=2071" rel="nofollow">http://dbaforums.org/oracle/index.php?showtopic=2071</a></p>
  
  <pre><code>'--------------------------------------
  ' create and open connection
  '--------------------------------------
  Dim oCn As New ADODB.Connection
  oCn.Open "Driver={Microsoft ODBC for Oracle};" &amp; _
  "Server=myserver;" &amp; _
  "Uid=gh_pc;" &amp; _
  "Pwd=gh_pc"
  
  '---------------------------------------
  ' open recordset
  '---------------------------------------
  Dim oRs As New ADODB.Recordset
  Set oRs = oCn.Execute("SELECT * FROM pc_ficha_clinica")
  While Not oRs.EOF
  Debug.Print oRs.Fields(0).Value
  oRs.MoveNext
  Wend
  '---------------------------------------
  ' cleanup
  '---------------------------------------
  oCn.Close
  Set oRs = Nothing
  Set oCn = Nothing
  </code></pre>
  
  <p>This is not working because it is missing the reference to ADOB.Connection. The following error appears (for me its German, I'm translating it here).</p>
  
  <p><code>The User defined Type is not declared</code></p>
  
  <p>I need to know how to Reference this OR how else to connect to the Database. If it is not possible to connect to an Oracle Database using a Word Makco I would like to know that as well.</p>
  
  <hr>
  
  <p><strong>EDIT</strong> Solution found by Dirk Vollmar and Wernfried Domscheit:</p>
  
  <p>Tools - References - add <code>Microsoft ActiveX Data Objects</code></p>
  
  <p>Hint for those who can not click the Reference option: Go to <code>Run-&gt;Reset</code> and Try again</p>