'替换这个函数看看:
Public Function openfile(ByVal filepath As String) As String '读入文件函数
Dim data As String
Open filepath For Input As #1
While Not EOF(1)
Line Input #1, sline
data = data & sline & vbNewLine'你忽略了最后1个换行符
Wend
Close #1
openfile = Left(data, Len(data) - Len(vbNewLine))'去掉被你忽略的换行符
End Function
这样看看:
MsgBox "-" & Trim(Text1.Text) & "-" & vbCrLf & _
"-" & Trim(Form1.pw) & "-"