[RESOLVED] Save Individual Sheet as .DBF DBase
Hey all,
Having a little problem trying to save one of the sheets as a .DBF DBase IV file. I can open a dBase into Excel and change the data as I choose, just fine. However when trying to save that sheet back into .DBF format, I am having some trouble.
When manually saving as .DBF, a prompt pops up asking that excel data format may not be preserved. After yes is answered, the saved file works fine...
The code I am using is this...
vb Code:
Application.DisplayAlerts = False
Dim gisSource As String
gisSource = lblGISData.Caption
Application.ScreenUpdating = False
Dim oBook As Workbook
Set oBook = Application.Workbooks.Add
Application.SheetsInNewWorkbook = 1
oBook.SaveAs gisSource
Workbooks("myBook.xls").Activate
Workbooks("myBook.xls").Worksheets("tempGISData").Activate
Dim splicedName As String
splicedName = spliceFileNameEnd3(gisSource)
Worksheets("tempGISData").Copy Before:=Workbooks(splicedName).Sheets(1)
Workbooks(splicedName).Sheets("Sheet1").Delete
Workbooks(splicedName).Save
Workbooks(splicedName).Close (False)
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Re: Save Individual Sheet as .DBF DBase
Got it working w/
vb Code:
Application.DisplayAlerts = False
Dim gisSource As String
gisSource = lblGISData.Caption
Application.ScreenUpdating = False
Dim oBook As Workbook
Set oBook = Application.Workbooks.Add
Application.SheetsInNewWorkbook = 1
oBook.SaveAs gisSource
Workbooks("myBook.xls").Activate
Workbooks("myBook.xls").Worksheets("tempGISData").Activate
Dim splicedName As String
splicedName = spliceFileNameEnd3(gisSource)
Worksheets("tempGISData").Copy Before:=Workbooks(splicedName).Sheets(1)
Workbooks(splicedName).Sheets("Sheet1").Delete
Workbooks(splicedName).ActiveSheet.Name = spliceFileNameEnd2(gisSource)
Workbooks(splicedName).Activate
ActiveWorkbook.SaveAs fileName:=lblGISData.Caption, FileFormat:=xlDBF4, CreateBackup:=False
Workbooks(splicedName).Close (False)
Application.ScreenUpdating = True
Application.DisplayAlerts = True