1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| Dim strLigneText As String
Dim y1 As Long
Dim y2 As Long
Dim x1 As Long
Dim x2 As Long
Dim x As Long
Dim y As Long
Dim z As Long
Dim FF1 As Integer, FF2 As Integer, i As Integer
Dim openfiledialog1 As New OpenFileDialog
Dim openfiledialog2 As New OpenFileDialog
'affecte les valeurs aux variables
y1 = txty1.Text
y2 = txty2.Text
x1 = txtx1.Text
x2 = txtx2.Text
'ouvre la boite de dialogue
openfiledialog1.Filter = "Fichier points (*.yxz)|*.yxz"
OpenFileDialog1.ShowDialog()
'tester le choix du fichier
If OpenFileDialog1.FileName <> "" Then
'ouvre le fichier
FF1 = FreeFile()
Openfiledialog1.FileName For Input As #FF1
FF2 = FreeFile()
Open "c:\temp\import_temp.txt" For Output As #FF2
'faire une lecture de la première ligne et créer une boucle pour lire toutes les lignes
Do Until EOF(1)
strLigneText = LineInput(1)
' coupe les lignes
'affecte aux variable les valeurs des coordonnées
x = Mid(strLigneText, 1, 9)
y = Mid(strLigneText, 10, 9)
z = Mid(strLigneText, 19, 9)
MsgBox(x)
MsgBox(y)
MsgBox(z)
'teste les coordonnées
If y > y1 And x < x1 Then
If y < y2 And x > x2 Then
'ecrit dans le fichier c:\temp\import_temp.txt
Print #FF2, strLigneText
Else
End If
End If
Loop
Close #FF1
Close #FF2 |
Partager