Solved Open a .DBF file to a tab in my worksheet

July 10, 2015 at 11:41:47
Specs: Windows 7
I need a macro that will open a .DBF file to a tab in my worksheet. Is this possible? If so, can you show me the code needed and if not would you have any alternative suggestions? Thank you

See More: Open a .DBF file to a tab in my worksheet

Report •

July 10, 2015 at 11:49:54
I don't often work with Macros, but when I do, I always just use the "Record Macro" option. In this case, just start the Macro Recording, and Insert External Data. Then, just follow the wizard. This is a simple answer, of course, but the Macro code will vary depending on the location of the file to import.

Report •

July 11, 2015 at 03:06:31
✔ Best Answer
irst open it to its own workbook, copy the data, close the dummy workbook.

Sub ABC()
Dim r1 as Range, r as Range, bk as Workbook
set r1 = Activesheet.range("A1")
set bk ="C:\Myfolder\Myfile.dbf")
set r = bk.worksheets(1).Range("A1").currentRegion
r.copy r1
bk.close SaveChanges:=False
end sub

That is the way I have been doing it successfully in xl2003 and earlier for years. Support for Saving as DBF was dropped in xl2007 for sure but I believe it can still read a dbf file.
And more use: DBF Restore Toolbox fo restore your files simple, link here:

Report •

Related Solutions

Ask Question