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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,522
Messages
6,114,112
Members
448,549
Latest member
brianhfield

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