1個用戶窗體(UserForm1)有一個列表框(ListBox1),並且在這個列表框中有3個項目,當我雙擊第一個項目時,它進入UserForm2,當我雙擊第二個項目時,它將轉到UserForm3,當我雙擊3項目時,它將轉到UserForm4。可以點擊打開另一個用戶窗體的列表框選擇用戶窗體
0
A
回答
0
私人小組ListBox1_DblClick(BYVAL取消作爲MSForms.ReturnBoolean)
Dim Obj As Object
Set Obj = VBA.UserForms.Add("UserForm" & CStr(ListBox1.ListIndex + 2))
Obj.Show
Unload Obj
結束子
+0
謝謝。您提供的代碼幫我找出我需要的代碼: '如果Me.ListBox.ListIndex = 0,則 UserForm1.Show 結束如果 如果Me.ListBox.ListIndex = 1,則 UserForm2.Show 結束If' – Hush
0
這些代碼可以被使用(當列表框的任何項目點擊時,用戶窗體另一個打開。打開的用戶表單文本框根據列表框中單擊的項目值填充):
Private Sub ListBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Load UserForm2
UserForm2.TextBox1 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 0)
UserForm2.TextBox2 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 1)
UserForm2.TextBox3 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 2)
UserForm2.TextBox4 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 3)
UserForm2.TextBox5 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 4)
UserForm2.TextBox6 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 5)
UserForm2.TextBox7 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 6)
UserForm2.TextBox8 = VBA.Format(UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 7), "#,##.00")
UserForm2.TextBox9 = VBA.Format(UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 8), "dd.mm.yyyy")
UserForm2.TextBox10 = UserForm1.ListBox2.List(UserForm1.ListBox2.ListIndex, 0)
Unload UserForm1
UserForm2.Show
End Sub
相關問題
- 1. 基於窗體組合框選擇打開另一個窗體並移動值
- 2. 如何從另一個窗體打開窗體中的窗體
- 3. 關閉一個子窗體並打開另一個窗體,單擊C#.net中的用戶控件按鈕。
- 4. 許多按鈕(用戶窗體)控制單個宏將根據選擇打開不同的用戶窗體
- 5. 用戶窗體列表框問題
- 6. 以編程方式從另一個窗體打開窗體窗體
- 7. 當點擊一個圖片框時打開一個新窗體
- 8. 關閉一個窗體並打開另一個窗體
- 9. 用戶窗體列表框填充和清除,取決於從另一個列表框中的選擇
- 10. Excel VBA刷新用戶窗體從另一個用戶窗體命令按鈕
- 11. Excel用戶窗體與列表來選擇多個項目
- 12. vb.net關閉多個窗體並打開另一個窗體
- 13. 如何在VB.NET中打開另一個窗體的窗體?
- 14. 關閉現有的窗體打開另一個窗體
- 15. 在列表框上選擇項目後打開新窗體
- 16. 在列表框中單擊項目時打開另一個窗體VB.net
- 17. Excel的用戶窗體組合框中選擇表把值
- 18. 用戶窗體組合框
- 19. 如何打開用戶窗體中的文件並使用打開的用戶窗體對其進行修改
- 20. 如何在c backgroundworker中打開另一個窗體窗體#
- 21. 從另一個窗體打開窗體接收錯誤c#
- 22. 如何從另一個孩子窗體打開孩子窗體?
- 23. 用戶窗體打開工作表時打開
- 24. 可以選擇一個框,打開另一個窗口或模式框?
- 25. 以windows窗體打開下拉列表
- 26. 刪除MultiSimple選擇列表框中的第一個項目選擇(窗體窗體應用程序)
- 27. 在選擇表格中的任何單元格後打開用戶窗體
- 28. PyQt5從另一個窗體調用另一個窗體
- 29. 需要將用戶輸入從1個窗體傳遞到另一個窗體
- 30. VBA用戶窗體
我不明白你的問題在哪裏?告訴我們你有什麼嘗試,你卡在哪裏? –