Private Sub Command1_Click()
Sum = 0
For n = 1 To Text1.Text
a = 1
For m = 1 To n
a = a * m
Next m
Sum = Sum + 1 / a
Next n
Print Sum
End Sub
Private Sub Form_Click()
Dim n As Integer
Dim sum, func
sum = 0
func = 1
way1:
n = Val(InputBox("请输入n的值" & vbCrLf & "注意:n<=20"))
If n > 20 Then GoTo way1 '判断输入是否大于20,是,重新输入
For i = 1 To n
func = func * i
sum = sum + 1 / func
Next i
Print sum
End Sub
Sub Text2_Click()
Text1.SelStart = 4
Text1.SelLength = 6
Text2.Text = Text1.SelText
End Sub
现在框1中写一段字符.单击框2就可以了.我已经上机验证了.完全正确
另外,虚机团上产品团购,超级便宜