I have this working sub that reads a file and display them when I clicked a button on the form. However, the information doesn't appear immediately after I clicked the button. I will need to close the form for the data to be displayed in A:
Private Sub CommandButton2_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim sFileName As String
Dim FileText$
Set ws = Worksheets("SL")
sFileName = "C:\SL.txt"
If Dir(sFileName) <> Empty Then
Application.ScreenUpdating = False
Open (sFileName) For Input As #1
N = 1
Do While Not EOF(1)
Input #1, FileText
ws.Cells(N, "A") = FileText
N = N + 1
Loop
Close #1
End If
End Sub
Bookmarks