Ciao a tutti.
Sto effettuando un banalissimo controllo di una variabile (string).
Il problema è che anche quando il controllo è vero, non mi entra nell' IF. Non so propio dove sbattere la testa. E' mai successo qualcosa di simile anche a voi, come lo avete risolto?
[code
Sub Macro1()
On Error GoTo errore
Dim prop As String
Dim nome As String
For i = 30001 To 31402
nome = "L" & CStr(i) & ".CR"
Documents.Open FileName:=nome
Selection.MoveDown Unit:=wdLine, Count:=21
Selection.MoveRight Unit:=wdCharacter, Count:=6
For x = 0 To 8
prop = prop & Selection.Text
Selection.MoveRight Unit:=wdCharacter, Count:=1
Next
'DOPO QUESTO CICLO, LA VARIABILE PROP CONTIENE IL NOME CHE DEVO CONTROLLARE, L'HO VERIFICATO
controllo = "nome"
If prop = controllo Then
MsgBox ("Propietario : " & prop & " Nome macchina : " & nome)
End If
'QUESTO E' IL CONTROLLO INCRIMINATO, quando prop ha valore "nome" , non mi entra comunque nell'IF
prop = ""
ActiveWindow.Close
Next
errore:
If Err.Number = 5174 Then
i = i + 1
nome = "L" & CStr(i) & ".CR"
Resume
End If
End Sub
[/code]