Private Function area(r As Double) As Double area = r ^ 2 * 3.142End Function
Private Sub Form_Click() Dim r As Double r = Val(InputBox("r=?")) If r > 0 Then Print "s=" & area(r) Else MsgBox "输入数据不符!" End IfEnd Sub