Consultor Eletrônico



Kbase P129532: How to connect an Excel macro to a Progress database
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/11/2008
Status: Unverified

GOAL:

How to connect an Excel macro to a Progress database

GOAL:

Is it possible to connect an Excel VB macro to a Progress database

GOAL:

How to use ODBC to connect an Excel macro to a Progress database

FACT(s) (Environment):

Windows
Progress 9.x
OpenEdge 10.x

FIX:

Below is an example of an Excel macro that connects to a sports2000 database. Ensure that you have added a reference to the Microsoft ActiveX Data Objects Recordset 2.8 Library by going to the Tools -> References menu:

Sub mymacro()

Set db_data = New ADODB.Connection
db_data.CursorLocation = adUseClient
db_data.Open "PROVIDER=MSDASQL;dsn=101as2k;uid=dis;pwd=dis;"

Set rs = db_data.Execute("Select name,phone From pub.customer where custnum < 10")

If rs.RecordCount <= 0 Then
MsgBox ("No data found")
End If

rs.MoveFirst
For I = 0 To rs.RecordCount - 1
ActiveSheet.Cells(I + 1, 1) = rs.Fields(0).Value
ActiveSheet.Cells(I + 1, 2) = rs.Fields(1).Value
rs.MoveNext
Next

rs.Close

End Sub