下面是简单实现,需要带入参数是大于等于1的正数(自己防呆)
Private Sub Command1_Click() '调用实例
Dim str As String
MsgBox return_str(5)
End Sub
Private Function return_str(number As Integer) As String '通用函数
Dim str As String
For i = 1 To number
Dim str_temp As String
str_temp = ""
' MsgBox str_temp
For j = 1 To i
str_temp = str_temp & CStr(i)
Next
str = str & str_temp
Next
return_str = str
End Function