bustermove
Structural
- Mar 17, 2003
- 1
'Please help ! I have copied this function right out of a book and I keep getting a compile error message regarding "loop without Do" even though a "do" is there in the code.Does anyone know why this is?
what am I forgetting?
'
'
'
Sub dxfsearch()
Dim dxffile, dxfsection, dxfentity, groupcode, _
description, dxfselection As String
Dim section, entity As Boolean
Dim GC As Variant
Dim groupcodes As Collection
Set groupcodes = New Collection
groupcodes.Add "0", "0"
groupcodes.Add "5", "5"
groupcodes.Add "6", "6"
groupcodes.Add "8", "8"
groupcodes.Add "10", "10"
groupcodes.Add "20", "20"
groupcodes.Add "30", "30"
groupcodes.Add "100", "100"
dxffile = "c:\winnt\temp\a4430004.dxf"
Open dxffile For Input As #1
dxfsection = "entities"
dxfentity = InputBox("", "specify entity name", "line"
dxfentity = UCase$(dxfentity)
Do
Line Input #1, groupcode
groupcode = Trim$(groupcode)
Line Input #1, description
If groupcode = "2" And description = dxfsection _
Then section = True
If groupcode = "0" And description = "ENDSEC" _
Then section = False
If section = True Then
If groupcode = "0" And description = dxfentity _
Then
entity = True
ElseIf groupcode = "0" And _
description <> dxfentity Then
entity = False
If dxfsection > "" Then
If MsgBox(dxfselection + vbCr, vbOKCancel) _
= vbCancel Then GoTo treminate
End If
If entity = True Then
For Each GC In groupcodes
If groupcode = groupcodes.Item(GC) Then
If groupcode = 0 Then dxfselection = _
dxfselection + vbCr
dxfselection = dxfselection + _
groupcode + vbTab + _
description + vbCr
End If
Next
End If
End If
Loop While description <> "EOF"
terminate:
Close #1
End Sub
what am I forgetting?
'
'
'
Sub dxfsearch()
Dim dxffile, dxfsection, dxfentity, groupcode, _
description, dxfselection As String
Dim section, entity As Boolean
Dim GC As Variant
Dim groupcodes As Collection
Set groupcodes = New Collection
groupcodes.Add "0", "0"
groupcodes.Add "5", "5"
groupcodes.Add "6", "6"
groupcodes.Add "8", "8"
groupcodes.Add "10", "10"
groupcodes.Add "20", "20"
groupcodes.Add "30", "30"
groupcodes.Add "100", "100"
dxffile = "c:\winnt\temp\a4430004.dxf"
Open dxffile For Input As #1
dxfsection = "entities"
dxfentity = InputBox("", "specify entity name", "line"
dxfentity = UCase$(dxfentity)
Do
Line Input #1, groupcode
groupcode = Trim$(groupcode)
Line Input #1, description
If groupcode = "2" And description = dxfsection _
Then section = True
If groupcode = "0" And description = "ENDSEC" _
Then section = False
If section = True Then
If groupcode = "0" And description = dxfentity _
Then
entity = True
ElseIf groupcode = "0" And _
description <> dxfentity Then
entity = False
If dxfsection > "" Then
If MsgBox(dxfselection + vbCr, vbOKCancel) _
= vbCancel Then GoTo treminate
End If
If entity = True Then
For Each GC In groupcodes
If groupcode = groupcodes.Item(GC) Then
If groupcode = 0 Then dxfselection = _
dxfselection + vbCr
dxfselection = dxfselection + _
groupcode + vbTab + _
description + vbCr
End If
Next
End If
End If
Loop While description <> "EOF"
terminate:
Close #1
End Sub