Function ImportTextFile(StrFileName As String, StrTempFile As String, StartLine As Integer, Headings As Boolean)
'*************************************************************************************************************************
'Created by :D Crake Icr@fT Limited
'Date :20th November 2008
'Arguments :StrFileFile - Name of file to read
' :StrTempFile - Name of file to create
' :StartLine - Which line contains the first row of data
' :Headings - Include the headings as row one in the output file
'
'Purpose :To open a given text file and remove the n number of rows that contain data that does not need to be imported
' :and save the actual data, including headings, if apporpriate, to a new text file.
' :The newly created text file can then be used to import the raw data from.
'Headings :If the file is being imported into a new table then set the headings argument to true
' :If appending to an exisiting table then set the headings argument to false.
'**************************************************************************************************************************
'Copywrite :There is no copywrite on this code, however, if passed on then pass on the above comments.
'**************************************************************************************************************************
'Temp variables
Dim nLines As Long 'line count
Dim TempStr As String 'Incoming line string
Open StrFileName For Input As #1
Open StrTempFile For Output As #2
'Do you need the headings in the output file
If Headings = True Then
StartLine = StartLine - 1
End If
Do While Not EOF(1) ' check if at end of file
nLines = nLines + 1
Line Input #1, TempStr 'Read incoming text
If nLines > StartLine Then
Print #2, TempStr 'write outgoing text
End If
Loop
'close both files
Close #1
Close #2
End Function