返回列表 上一主題 發帖

請教各位先進多個OptionButton設定

回復 1# acdx
If TypeName(opt2) = "OptionButton" then       '先確定opt2是OptionButton控制項
    If opt2.Value Then  '才能確定它有Value屬性
        flg = True                                                                              
        PR_Index = opt2.Caption
        Exit For
    End If
End if

TOP

回復 5# acdx
當我的Userform裡有多個frame含有OptionButton時該如何避免程式每次都由第一個(OptionButton11)開始檢查?

程式不會從第一個檢查
For Each opt2 In Frame28.Controls
這是對所有在Frame28內部的控制項,除非你的Frame5又在Frame28內部,否則應該不會有你說的情況。

那,假設Frame5真的在Frame28內部,
你只想檢查Frame28內第一層的OptionButton(不含子Frame內部的OptionButton)
可以用..
For Each opt2 In Frame28.Controls
    If opt2.parent is Frame28 and TypeName(opt2) = "OptionButton" then
這樣去篩選

TOP

        靜思自在 : 【生命在呼吸間】佛陀說:「生命在呼吸間。」人無法管住自己的生命,更無法擋住死期,讓自己永住人間。既然生命去來這麼無常,我們更應該好好地愛惜它、利用它、充實它,讓這無常、寶貴的生命,散發它真善美的光輝,映照出生命真正的價值。
返回列表 上一主題