Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

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

  1. #1
    New Member
    Join Date
    Jan 2003
    Grantham, Lincolnshire, UK.
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)


    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.

  2. #2
    MrExcel MVP
    Andrew Poulsom's Avatar
    Join Date
    Jul 2002
    Post Thanks / Like
    0 Post(s)
    1 Thread(s)


    This worked for me:

    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

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts