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
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