VBA programming - Data extraction from DBF file to excel?

I have a database - SampleDo.dbf and would like to extract only the field Date,DO_no,Qty and code to excel file with condition. (Condition will be the date, eg. month = 8 and year = 2010). Can you please help me with the VBA program to extract the data.

Thanks !
Update: Stas s, Thanks for your prompt reply. Is this VBA program work from excel . (Note : I am extracting from DBF file and not access). I run the Macro, and it give me compile error : user-defined type not defined on line : "Public Sub GetCn(ByRef dbcon As ADODB.Connection, ByRef dbrs As ADODB.Recordset,... show more Stas s, Thanks for your prompt reply. Is this VBA program work from excel . (Note : I am extracting from DBF file and not access).

I run the Macro, and it give me compile error : user-defined type not defined on line :

"Public Sub GetCn(ByRef dbcon As ADODB.Connection, ByRef dbrs As ADODB.Recordset, _
sqlstr As String, dbfile As String)"
Update 2: Stas s, Thanks for your prompt reply. Is this VBA program work from excel . (Note : I am extracting from DBF file and not access). I run the Macro, and it give me compile error : user-defined type not defined on line : "Public Sub GetCn(ByRef dbcon As ADODB.Connection, ByRef dbrs As ADODB.Recordset,... show more Stas s, Thanks for your prompt reply. Is this VBA program work from excel . (Note : I am extracting from DBF file and not access).

I run the Macro, and it give me compile error : user-defined type not defined on line :

"Public Sub GetCn(ByRef dbcon As ADODB.Connection, ByRef dbrs As ADODB.Recordset, _
sqlstr As String, dbfile As String)"
1 answer 1