Sub Conversion()
Application.ScreenUpdating = False
MyMonth = Format(Now, "mmmm")
MyYear = Format(Now, "yyyy")
MyCSVPath = "C:\Documents and Settings\JThomps2\Desktop\WorkflowOne\Billing\" & MyYear & "\" & MyMonth & "\Daily CSV Files\"
On Error GoTo line60
With Application.FileSearch
.NewSearch
.LookIn = MyCSVPath
.FileType = msoFileTypeAllFiles
.Filename = "*baycity_rpt.txt"
.Execute
Set txtfile = Workbooks.Open(.FoundFiles(1))
End With
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A:A").Select
Selection.Replace What:="Total ", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Selection.Replace What:="Total ", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Selection.Replace What:="Total ", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Range("A3").Value = Range("A2").Value
Range("A3").Select
Selection.TextToColumns Destination:=Range("A3"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="/", FieldInfo:=Array(Array(1, 2), Array(2, 1), Array(3, 1)), _
TrailingMinusNumbers:=True
Range("A3").Select
Selection.Replace What:="0", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Cells(lastRow - 3, "B").Value = "test"
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\JThomps2\Desktop\WorkflowOne\Billing\" & MyYear & "\" & MyMonth & "\Daily CSV Files\baycity " & Range("A3").Value & "-" & Range("B3").Value & "-" & Range("C3").Value & ".xls"
Application.DisplayAlerts = False
Kill MyCSVPath & "*baycity_rpt.txt"
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Call Conversion2
End Sub
Sub Conversion2()
Application.ScreenUpdating = False
MyMonth = Format(Now, "mmmm")
MyYear = Format(Now, "yyyy")
MyCSVPath = "C:\Documents and Settings\JThomps2\Desktop\WorkflowOne\Billing\" & MyYear & "\" & MyMonth & "\Daily CSV Files\"
On Error GoTo line123
With Application.FileSearch
.NewSearch
.LookIn = MyCSVPath
.FileType = msoFileTypeAllFiles
.Filename = "*saginaw_rpt.txt"
.Execute
Set txtfile = Workbooks.Open(.FoundFiles(1))
End With
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A:A").Select
Selection.Replace What:="Total ", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Selection.Replace What:="Total ", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Selection.Replace What:="Total ", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Range("A3").Value = Range("A2").Value
Range("A3").Select
Selection.TextToColumns Destination:=Range("A3"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="/", FieldInfo:=Array(Array(1, 2), Array(2, 1), Array(3, 1)), _
TrailingMinusNumbers:=True
Range("A3").Select
Selection.Replace What:="0", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Cells(lastRow - 3, "B").Value = "test"
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\JThomps2\Desktop\WorkflowOne\Billing\" & MyYear & "\" & MyMonth & "\Daily CSV Files\saginaw " & Range("A3").Value & "-" & Range("B3").Value & "-" & Range("C3").Value & ".xls"
Application.DisplayAlerts = False
Kill MyCSVPath & "*saginaw_rpt.txt"
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub