i am trying to open a file to which has some cnc machine data
in it,but cant seem to crack why or what i am doing wrong
i need to open this file and search for data that confirms that the
machine has actually performed its task.
i have 2 questions
1.what is the most efficient way to search the data in the file
2. how do you open the file for reading the data
here is the code i am using to open the file which does have
data in it.The code opens the file but seems to think thats its empty.Any help greatly appreciated
On Error GoTo HandleErr:
Dim Folderspec As String
Dim Mychar
Folderspec = DLookup("[ProjectPath]", "ProjectPath", "[id] =" & 10)
With Application.FileSearch
.NewSearch
.LookIn = Folderspec
.SearchSubFolders = True
.FileName = "C14200.r41"
.MatchTextExactly = True
If .Execute > 0 Then
Open .FileName For Output Shared As #1
Do While Not EOF(1) ' Loop until end of file.
Input #1, Mychar
Debug.Print Mychar
Loop
Close #1
End With
ExitHere:
Exit Sub
HandleErr:
If err.Number = 53 Then
JobFound = False
Resume ExitHere:
Else
MsgBox err.Description & err.Number
Resume ExitHere:
End If
in it,but cant seem to crack why or what i am doing wrong
i need to open this file and search for data that confirms that the
machine has actually performed its task.
i have 2 questions
1.what is the most efficient way to search the data in the file
2. how do you open the file for reading the data
here is the code i am using to open the file which does have
data in it.The code opens the file but seems to think thats its empty.Any help greatly appreciated
On Error GoTo HandleErr:
Dim Folderspec As String
Dim Mychar
Folderspec = DLookup("[ProjectPath]", "ProjectPath", "[id] =" & 10)
With Application.FileSearch
.NewSearch
.LookIn = Folderspec
.SearchSubFolders = True
.FileName = "C14200.r41"
.MatchTextExactly = True
If .Execute > 0 Then
Open .FileName For Output Shared As #1
Do While Not EOF(1) ' Loop until end of file.
Input #1, Mychar
Debug.Print Mychar
Loop
Close #1
End With
ExitHere:
Exit Sub
HandleErr:
If err.Number = 53 Then
JobFound = False
Resume ExitHere:
Else
MsgBox err.Description & err.Number
Resume ExitHere:
End If