how to read dbf file using macro?

M

musa.biralo

Hi,
i want to read each row of specific column of musa.dbf using macro
(VBA) in excel.
my main gole is to copy the data of dbf file to excel file.
I am new but want to do something..i tried and tried...and finally i am
here....
help me.

musa.biralo
 
T

Tom Ogilvy

if it is dbf 3 of 4 format

Dim sPath as String
sPath = "C:\MyDBFFiles\"
workbooks.Open sPath & musa.dbf
Activeworkbook.SaveAs sPath & "musa.xls", xlWorkbookNormal
 
M

musa.biralo

Thank you Tom

This code simply saved the musa.dbf as musa.xls.

My main target is to get the DATA from a simple dbf file and populate
it in excel. what my real need is to open the dbf file and get the
value from there then populate the value in excel.

Can you direct me to the place where i can get such information. if you
have such code that will be the best....

Once again, thank you for the help.
 
N

NickHK

Can you Query the database/file /
Check out Data>New Database query and follow the Wizard.
Make sure you understand about DSNs and/or connection string.

NickHK
 
G

Guest

my main gole is to copy the data of dbf file to excel file.

so when it is saves as an excel file, the data from the dbf file isn't in an
excel file?

I believe it is. If you want to populate an existing file, then open it in
excel as I have shown you, then access the cells you want and place the
values in the location you want of the existing file. then close the open
dbf file without saving.

You can also approach it as Nick has suggested - it is pretty much the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top