Macro to Transfer Data From a DBF File to an Excel Workbook.

tigrou

New Member
Joined
Jan 24, 2003
Messages
24
Hi. I have a workbook with a table that is updated daily with a row of figures. The first column of the table contains specific dates relating to the financial year. The table is used by another worksheet to vlookup data for a range of dates such as a fiscal month. I'd prefer not to add new data (e.g. for a new day) by simply inserting a blank row. The file that I extract the data from (e.g electricity, gas, steam meter readings) is a DBF file. The DBF file has a different name each day e.g 2003 02 14 0000 (Wide).DBF I've managed to create a macro (using a string denoting the file path and date as file name etc.) to open up the relevant DBF file but the only way I can get it to run is by changing the long date format on the global settings of my computer to match the date and time format of the DBF file e.g yyyy mm dd hhmm. So far as the macro is concerned I'm having trouble in changing the dim date property to match VbLongdate. Is there anyone who can help please. Many thanks in anticipation.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
This worked for me:

Code:
Sub Test()
    Dim Y As String
    Dim M As String
    Dim D As String
    Dim FName As String
    Y = Format(Year(Now), "0000")
    M = Format(Month(Now), "00")
    D = Format(Day(Now), "00")
    FName = Y & " " & M & " " & D & " 0000  (Wide).DBF"
    MsgBox FName
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,553
Messages
6,114,279
Members
448,562
Latest member
Flashbond

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top