|
- Sub WithOnAction()
- Dim i As Long, aName
- aName = Array("张三", "李四", "王五", "赵六")
- For i = LBound(aName) To UBound(aName)
- With ActiveSheet.Shapes.AddFormControl(xlButtonControl, 10, 30 * i + 20, 100, 20)
- .Name = aName(i)
- With .TextFrame.Characters
- .Text = i & aName(i)
- End With
- .OnAction = "Employee"
- End With
- Next
- End Sub
- Sub Employee()
- Dim sStr As String
- Select Case Application.Caller
- Case "张三": sStr = "张三,男,21"
- Case "李四": sStr = "李四,女,24"
- Case "王五": sStr = "王五,男,25"
- Case "赵六": sStr = "赵六,男,39"
- End Select
- EmployeeInfo sStr
- End Sub
- Sub EmployeeInfo(ByVal str As String)
- Debug.Print str
- End Sub
复制代码
附件就不上了。 |
|