VBAで画像がランダムに表示されるようなコードを教えていただきたいです.
以下現在書いているコードです.
画像の配列の後にランダム関数を入れてピクチャーボックスに画像を表示させようとしているのですが,うまくいきません.
アドバイスをお願いします.
Private Sub start_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, _
ByVal X As Single, ByVal Y As Single)
Select Case Button
Case 1
Dim strPicture1(9) As String
strPicture1(0) = "C:\Users\Desktop\VBA\rr.jpg"
strPicture1(1) = "C:\Users\Desktop\VBA\rg.jpg"
strPicture1(2) = "C:\Users\Desktop\VBA\rb.jpg"
strPicture1(3) = "C:\Users\Desktop\VBA\gr.jpg"
strPicture1(4) = "C:\Users\Desktop\VBA\gb.jpg"
strPicture1(5) = "C:\Users\Desktop\VBA\gg.jpg"
strPicture1(6) = "C:\Users\Desktop\VBA\bb.jpg"
strPicture1(7) = "C:\Users\Desktop\VBA\br.jpg"
strPicture1(8) = "C:\Users\Desktop\VBA\bg.jpg"
Dim a As Variant a = Array("あか", "あお", "みどり") L = a(Int(Rnd() * 3)) Label7.Visible = True Label8.Visible = False Label7.Caption = L Label7.Font.Size = 100 Case 2
Dim b As Variant
b = Array("あか", "あお", "みどり")
M = b(Int(Rnd() * 3))
Label7.Visible = False
Label8.Visible = True
Label8.Caption = M
Label8.Font.Size = 100
End Select
End Sub