Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer, p As Double
        Dim t As Double, sum_e As Double
        i = 1 : p = 1 : sum_e = 1
        Do
            p = p * i       ' 计算i的阶乘
            t = 1 / p
            sum_e = sum_e + t
            i = i + 1       ' 为计算下一项作准备
        Loop Until t <= 0.00001
        Debug.Print(sum_e)
    End Sub
End Class
