Results 1 to 2 of 2

Thread: [RESOLVED] Save Individual Sheet as .DBF DBase

  1. #1

    Thread Starter
    Hyperactive Member pgag45's Avatar
    Join Date
    Mar 2007
    Location
    Colorado
    Posts
    262

    Resolved [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:
    1. Application.DisplayAlerts = False
    2. Dim gisSource As String
    3. gisSource = lblGISData.Caption
    4. Application.ScreenUpdating = False
    5. Dim oBook As Workbook
    6. Set oBook = Application.Workbooks.Add
    7. Application.SheetsInNewWorkbook = 1
    8. oBook.SaveAs gisSource
    9. Workbooks("myBook.xls").Activate
    10. Workbooks("myBook.xls").Worksheets("tempGISData").Activate
    11. Dim splicedName As String
    12. splicedName = spliceFileNameEnd3(gisSource)
    13. Worksheets("tempGISData").Copy Before:=Workbooks(splicedName).Sheets(1)
    14. Workbooks(splicedName).Sheets("Sheet1").Delete
    15. Workbooks(splicedName).Save
    16. Workbooks(splicedName).Close (False)
    17. Application.ScreenUpdating = True
    18. Application.DisplayAlerts = True

  2. #2

    Thread Starter
    Hyperactive Member pgag45's Avatar
    Join Date
    Mar 2007
    Location
    Colorado
    Posts
    262

    Re: Save Individual Sheet as .DBF DBase

    Got it working w/

    vb Code:
    1. Application.DisplayAlerts = False
    2. Dim gisSource As String
    3. gisSource = lblGISData.Caption
    4. Application.ScreenUpdating = False
    5. Dim oBook As Workbook
    6. Set oBook = Application.Workbooks.Add
    7. Application.SheetsInNewWorkbook = 1
    8. oBook.SaveAs gisSource
    9. Workbooks("myBook.xls").Activate
    10. Workbooks("myBook.xls").Worksheets("tempGISData").Activate
    11. Dim splicedName As String
    12. splicedName = spliceFileNameEnd3(gisSource)
    13. Worksheets("tempGISData").Copy Before:=Workbooks(splicedName).Sheets(1)
    14. Workbooks(splicedName).Sheets("Sheet1").Delete
    15. Workbooks(splicedName).ActiveSheet.Name = spliceFileNameEnd2(gisSource)
    16. Workbooks(splicedName).Activate
    17. ActiveWorkbook.SaveAs fileName:=lblGISData.Caption, FileFormat:=xlDBF4, CreateBackup:=False
    18. Workbooks(splicedName).Close (False)
    19. Application.ScreenUpdating = True
    20. Application.DisplayAlerts = True

Posting Permissions

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



Click Here to Expand Forum to Full Width