Sub Dowhile3()
Dim LineCt As Long '定义长整型变量
Dim LineOfText As String '定义字符串变量
Open "\Documents and Settings\Administrator\桌面\bulletin.txt" For Input As #1 ’打开文件
LineCt = 0 '变量赋值
Do While Not EOF(1) '循环语句与loop匹配,检测是否到文件尾。符合条件则退出
Line Input #1, LineOfText '按行读取数据,写入LineOfText
Range("A1").Offset(LineCt, 0) = UCase(LineOfText) '将数据写入sheet1表a1中,Offset(LineCt, 0)向下偏移LineCt=1则目标为A2 ,UCase转成大写字符
LineCt = LineCt + 1 '累加变量每读一行增加1
Loop '循环语句
Close #1 '关闭文件号1的文件
End Sub