Private Sub Command1_Click()
CriaArq
End Sub
Private Sub CriaArq()
If Not File_Exists("C:Teste.txt", False) Then
Open "C:Teste.txt" For Output As #1
Print #1, "Senha"
Close #1
End If
End Sub
Private Sub LerArq()
Dim strABC As String
If File_Exists("C:Teste.txt", False) Then
Open "C:Teste.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, strABC
MsgBox "Esta é a senha " & strABC
Loop
Close #1
End If
End Sub
Function File_Exists(ByVal PathName As String, Optional Directory As Boolean) As Boolean
If PathName <> "" Then
If IsMissing(Directory) Or Directory = False Then
File_Exists = (Dir$(PathName) <> "")
Else
File_Exists = (Dir$(PathName, vbDirectory) <> "")
End If
End If
End Function
Private Sub Command2_Click()
LerArq
End Sub