Private Sub Command1_Click() Dim n As Integer Dim sum As Double sum = 0 n = InputBox("请输入n的值") For i = 1 To n sum = sum + 1 / i Next i Print sumEnd Sub