Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function basLoseLastLine(fName As String, _
Optional RecSep As String = vbCrLf, _
Optional FldSep As String = ",") As Variant
Dim Fil As Integer
Dim RawFile As String 'Holds the entire contents of the file
Dim RawSplit() As Variant 'the file split up on a line per line basis
Dim RptAry() As String '2d array. Holds X lines & 0 to 4 elements per line
Fil = FreeFile 'get the next free file number
Open fName For Binary As #Fil 'Open file
RawFile = String$(LOF(Fil), 32) 'Create "empty" String of Length
Get #Fil, 1, RawFile 'Fill "Empty Str with File
'Get the Nunber of Records and Fields
RawSplit = Split(RawFile, RecSep) 'Split the file up by lines
'Lose the Last Element of the Array
ReDim Preserve RawSplit(UBound(RawSplit) - 1)
'Put this Back together
RawFile = Join(RawSplit, vbCrLf)
Put #Fil, 1, RawFile 'Replace Original File
Close #Fil 'Close File
End Function