Excel 2002 Power Programming with VBA phần 10

Tạo thanh công cụ mới. Bạn có thể tạo càng nhiều thanh công cụ mới như bạn muốn, với các điều khiển thanh công cụ từ bất kỳ nguồn nào. ✦ Thay đổi các chức năng điều khiển thanh công cụ được xây dựng trong. Bạn làm điều này bằng cách gắn vĩ mô của riêng bạn để kiểm soát được xây dựng trong | 852 Part VII Other Topics using a UserForm_QueryClose event procedure in the code module for the UserForm. The following example does not allow the user to close the form by clicking the Close button Private Sub UserForm_QueryClose _ Cancel As Integer CloseMode As Integer If CloseMode vbFormControlMenu Then MsgBox You can t close the form like that. Cancel True End If End Sub I ve created a UserForm whose controls are linked to cells on the worksheet with the Controlsource property. Is this the best way to do this In general you should avoid using links to worksheet cells unless you absolutely must. Doing so can slow your application down because the worksheet is recalculated every time a control changes the cell. Is there any way to create a control array for a UserForm It s possible with Visual Basic but I can t figure out how to do it with Excel VBA. You can t create a control array but you can create an array of Control objects. The following code creates an array consisting of all CommandButton controls Private Sub UserForm_Initialize Dim Buttons As CommandButton Cnt 0 For Each Ctl In If TypeName Ctl CommandButton Then Cnt Cnt 1 ReDim Preserve Buttons 1 To Cnt Set Buttons Cnt Ctl End If Next Ctl End Sub Is there any difference between hiding a UserForm and unloading a UserForm Yes the Hide method keeps the UserForm in memory but makes it invisible. The Unload statement unloads the UserForm beginning the termination process invoking the Terminate event for the UserForm and removing the UserForm from memory. Chapter 30 Frequently Asked Questions about Excel Programming 853 How can I make my UserForm stay open while I do other things By default each UserForm is modal which means that it must be dismissed before you can do anything else. Beginning with Excel 2000 however you can make a UserForm modeless by writing vbModeless as the argument for the Show method. Here s an example vbModeless Excel 97 gives me a compile error .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.