透過以下程式做法來做切換,以for回傳搭配亂數來運作。
Sub aa(a As Integer, b As String) Debug.Print "a", a, b End Sub Sub bb(a As Integer, b As String) Debug.Print "b", a, b End Sub Sub cc(a As Integer, b As String) Debug.Print "c", a, b End Sub Sub main() Dim a a = Array("aa", "bb", "cc") Randomize Run a(Int(Rnd() * (UBound(a) + 1))), Int(Rnd() * 100) + 1, "abc" End Sub執行畫面。
沒有留言:
張貼留言