Joel - The DBF Solved

B

Bob Barnes

Joel...trying to use the Filter resulted in the errors we discussed previously.

Code like this worked..Thank you for your Help.

Private Sub SaveGoCSV()
Dim BkName$, CCName$, LastRow$, M$, DBFName$
Dim objXLApp As Object 'Excel.Application
Dim Wb As Object, Wb2 As Object 'Excel.Workbook
Dim objXLSheet As Object 'Excel.Worksheet
On Error GoTo AAA1

BkName = "C:\Stores\" & cboADBF

Set Wb = Workbooks.Open(filename:=BkName)
'create workbook to copy filtered data
Set Wb2 = Workbooks.Add(template:=xlWBATWorksheet)

With Wb.Sheets(2)
'create new filename to save file
DBFName = Replace(cboADBF, "xls", "dbf")
CCName = "C:\Stores\" & DBFName
If Dir(CCName) <> "" Then Kill CCName
.SaveAs filename:=CCName, FileFormat:= _
xlDBF4, CreateBackup:=False
End With

Wb.Close savechanges:=False
Wb2.Close savechanges:=False
AAA2:
Exit Sub
AAA1:
Select Case Err
Case Else
MsgBox "Error Number " & Err.Number & " " & Err.Description: Resume AAA2
End Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top