...ma perchè non si possono allegare i file testo?...
Option Explicit
Dim frase As String
Dim i As Integer
Dim tagsi(1 To 6) As Integer
Dim tags(1 To 6) As String
Dim directory As String
Dim cont As Integer
Dim str_frase As Integer
Dim j As Integer
Dim tagsi2(1 To 6) As Integer
Dim ultimo As String
Dim ultimo2 As String
Private Sub Command1_Click()
cont = 0
For i = 1 To 6
tagsi(i) = 0
Next
Open directory & "\errori.txt" For Output As #2
Close #2
Open directory & "\doc.html" For Input As #1
Do While Not EOF(1)
For i = 1 To 6
tagsi2(i) = 0
Next
Line Input #1, frase
cont = cont + 1
For i = 1 To 6
str_frase = InStr(1, frase, tags(i))
If str_frase <> 0 Then
If i > 1 Then
If (tagsi(i - 1) > 0) And (ultimo <> tags(i)) Then
tagsi(i) = tagsi(i) + 1
ultimo = tags(i)
Else
Open directory & "\errori.txt" For Append As #2
Print #2, "L'errore di " & tags(i) & " è stato riscontrato nella linea " & cont
Close #2
End If
Else
tagsi(i) = tagsi(i) + 1
If tagsi(i) > 1 Then
For j = 1 To 6
str_frase = InStr(1, frase, tags(j))
If str_frase <> 0 Then
If j > 1 Then
If (tagsi2(j - 1) > 0) And (ultimo2 <> tags(j)) Then
tagsi2(j) = tagsi2(j) + 1
ultimo2 = tags(j)
Else
Open directory & "\errori.txt" For Append As #2
Print #2, "L'errore di " & tags(j) & " è stato riscontrato nella linea " & cont
Close #2
End If
End If
End If
Next
End If
End If
End If
Next
Loop
Close #1
End Sub
Private Sub Form_Load()
ultimo = "a"
ultimo2 = "b"
tags(1) = "<table"
tags(2) = "<tr>"
tags(3) = "<td>"
tags(4) = "</td>"
tags(5) = "</tr>"
tags(6) = "</table>"
directory = "C:\....visual basic\file html"
End Sub

Rispondi quotando