M
Mike
I have some code I am working on. One function reads a file using fso, then
I have multiple functions using the string read from the file. Each
function splits the lines up and will return one value.
Is there a better way? Is handling this many array which are basically the
same going to cause some server distress?
Thanks
Mike
Code:
Function ReadFile(strFileName)
Dim objFSO, ts, s
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set ts = objFSO.OpenTextFile(strFileName, 1)
s = ts.Readall
ts.Close
Set objFSO = Nothing
ReadFile = s
End Function
Function GetBarCode(strBarcodeLine)
Dim Arline1, Arline2, ArCell1, strBarcode
Arline1 = Split(strBarcodeLine, vbCrLf)
Arline2 = Split(Arline1(0), ",")
ArCell1 = Split(Arline2(0), "=")
strBarcode = Trim(ArCell1(1))
GetBarCode = strBarcode
End Function
Function GetPlateFormat(strPlateFormatLine)
Dim Arline1, Arline2, ArCell1, strPlateFormat
Arline1 = Split(strPlateFormatLine, vbCrLf)
Arline2 = Split(Arline1(1), ",")
ArCell1 = Split(Arline2(0), "=")
strPlateFormat = Trim(ArCell1(1))
GetPlateFormat = strPlateFormat
End Function
Function GetPlateDate(strPlateDateLine)
Dim Arline1, Arline2, ArCell1, datPlateDate
Arline1 = Split(strPlateDateLine, vbCrLf)
Arline2 = Split(Arline1(3), ",")
ArCell1 = Split(Arline2(0), "=")
datPlateDate = Trim(ArCell1(1))
GetPlateDate = datPlateDate
End Function
Function GetReceivingLab(strReceivingLabLine)
Dim Arline1, Arline2, ArCell1, strReceivingLab
Arline1 = Split(strReceivingLabLine, vbCrLf)
Arline2 = Split(Arline1(5), ",")
ArCell1 = Split(Arline2(0), "=")
strReceivingLab = Trim(ArCell1(1))
GetReceivingLab = strReceivingLab
End Function
Dim strFileRead
strFileRead = ReadFile(strImportFiles)
I have multiple functions using the string read from the file. Each
function splits the lines up and will return one value.
Is there a better way? Is handling this many array which are basically the
same going to cause some server distress?
Thanks
Mike
Code:
Function ReadFile(strFileName)
Dim objFSO, ts, s
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set ts = objFSO.OpenTextFile(strFileName, 1)
s = ts.Readall
ts.Close
Set objFSO = Nothing
ReadFile = s
End Function
Function GetBarCode(strBarcodeLine)
Dim Arline1, Arline2, ArCell1, strBarcode
Arline1 = Split(strBarcodeLine, vbCrLf)
Arline2 = Split(Arline1(0), ",")
ArCell1 = Split(Arline2(0), "=")
strBarcode = Trim(ArCell1(1))
GetBarCode = strBarcode
End Function
Function GetPlateFormat(strPlateFormatLine)
Dim Arline1, Arline2, ArCell1, strPlateFormat
Arline1 = Split(strPlateFormatLine, vbCrLf)
Arline2 = Split(Arline1(1), ",")
ArCell1 = Split(Arline2(0), "=")
strPlateFormat = Trim(ArCell1(1))
GetPlateFormat = strPlateFormat
End Function
Function GetPlateDate(strPlateDateLine)
Dim Arline1, Arline2, ArCell1, datPlateDate
Arline1 = Split(strPlateDateLine, vbCrLf)
Arline2 = Split(Arline1(3), ",")
ArCell1 = Split(Arline2(0), "=")
datPlateDate = Trim(ArCell1(1))
GetPlateDate = datPlateDate
End Function
Function GetReceivingLab(strReceivingLabLine)
Dim Arline1, Arline2, ArCell1, strReceivingLab
Arline1 = Split(strReceivingLabLine, vbCrLf)
Arline2 = Split(Arline1(5), ",")
ArCell1 = Split(Arline2(0), "=")
strReceivingLab = Trim(ArCell1(1))
GetReceivingLab = strReceivingLab
End Function
Dim strFileRead
strFileRead = ReadFile(strImportFiles)