标准模块:
Type pinfo
name As String * 4
age As Integer
addr As String * 10
End Type
窗体模块
Option Base 1(声明)
Private Sub Form_Click()
Static a() As pinfo
Open App.Path & “\p_list.dat” For Append As #1
n = InputBox(“请问你要输入几个人的信息?”)
ReDim a(n) As pinfo
For i = 1 To n
a(i).name = InputBox(“请输入姓名”)
a(i).age = InputBox(“请输入年龄”)
a(i).addr = InputBox(“请输入所在地区”)
Write #1, a(i).name, a(i).age, a(i).addr
Next
Close #1
b = MsgBox(“文件写入完毕是否查看该文件?”, vbYesNo + vbQuestion)
If b = vbYes Then
Shell " explorer " & App.Path & “\p_list.dat”
End If
End Sub
解决方案:
Shell " explorer " & App.Path & “\p_list.dat”
这个explorer后面有个空格不能落下