By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,034 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

how to read dbf file using macro?

P: n/a
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

Sep 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
This is from the database side.
In Access:
Set up a simple select query that selects all the appropriatedbf data
Let's say that you name it qryDBFDataForExcel
Lets say you want to export the dbf data to an Excel spreadsheet with the
path and name of "c:\MyDBFInWkBk.xls

DoCmd.TransferSpreadsheet acExport, 8, "qryDBFDateForExcel",
"c:\MyDBFInWkBk.xls"

The acExport tells it that the data is outbound.
The 8 tells it to create Excel version Ofc97 or later.
The "qryDBFDateForExcel" tells it which query or table to export data from.
The "c:\myDBFInWkBk.xls" tells it what workbook to create and place the data
in and where that workbook will be located.

You will then have a spreadsheet with the column titles from the DBF
fieldnames and all the data from DBF under the appropriate
Column titles.

You can modularize this by using variables to store the query and file names
and then process any number of DBFs to excel.

__________________________________________________ __________________

On the other hand if you only have one dbf and want all of the data in the
DBF you can open Excel.
Go to File: Open and double click on the DBF filename. That will open the
file in Excel. You can then save it as an Excel workbook.
"musa.biralo" <mu*********@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
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

Sep 15 '06 #2

P: n/a
Thank you Kc_Mass

Though i was not looking for this, i learned new things... and i really
appreciate the explanation you provide. Such explanation really helps
to understand the code.

musa.biralo

Kc-Mass wrote:
This is from the database side.
In Access:
Set up a simple select query that selects all the appropriatedbf data
Let's say that you name it qryDBFDataForExcel
Lets say you want to export the dbf data to an Excel spreadsheet with the
path and name of "c:\MyDBFInWkBk.xls

DoCmd.TransferSpreadsheet acExport, 8, "qryDBFDateForExcel",
"c:\MyDBFInWkBk.xls"

The acExport tells it that the data is outbound.
The 8 tells it to create Excel version Ofc97 or later.
The "qryDBFDateForExcel" tells it which query or table to export data from.
The "c:\myDBFInWkBk.xls" tells it what workbook to create and place the data
in and where that workbook will be located.

You will then have a spreadsheet with the column titles from the DBF
fieldnames and all the data from DBF under the appropriate
Column titles.

You can modularize this by using variables to store the query and file names
and then process any number of DBFs to excel.

__________________________________________________ __________________

On the other hand if you only have one dbf and want all of the data in the
DBF you can open Excel.
Go to File: Open and double click on the DBF filename. That will open the
file in Excel. You can then save it as an Excel workbook.
"musa.biralo" <mu*********@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
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
Sep 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.