TAILIEUCHUNG - Excel 2002 Power Programming with VBA phần 7

Thủ tục này sẽ hiển thị một hộp tin nhắn có chứa một mô tả của mục đã chọn. Khi sự kiện Chọn xảy ra, các đối số ElementID chứa một số nguyên tương ứng với những gì đã được lựa chọn. Các ARG1 và Arg2 | Chapter 18 Working with Charts 555 Case xlXErrorBars Id XErrorBars Case xlYErrorBars Id YErrorBars Case xlLegendEntry Id LegendEntry Case xlLegendKey Id LegendKey Case xlAxis Id Axis Case xlMajorGridlines Id MajorGridlines Case xlMinorGridlines Id MinorGridlines Case xlAxisTitle Id AxisTitle Case xlUpBars Id UpBars Case xlDownBars Id DownBars Case xlSeriesLines Id SeriesLines Case xlHiLoLines Id HiLoLines Case xlDropLines Id DropLines Case xlRadarAxisLabels Id RadarAxisLabels Case xlShape Id Shape Case xlNothing Id Nothing Case Else Id Some unknown thing End Select MsgBox Selection type Id End Sub This procedure displays a message box that contains a description of the selected item. When the Select event occurs the ElementID argument contains an integer that corresponds to what was selected. The Arg1 and Arg2 arguments provide additional information about the selected item see the online help for details . The Select Case structure converts the built-in constants to descriptive strings. Enabling events for an embedded chart As I noted in the previous section Chart events are automatically enabled for chart sheets but not for charts embedded in a worksheet. To use events with an embedded chart you need to perform the following steps Create a class module In the VB Editor window select your project in the Project window and select Insert Class Module. This will add a new empty class module to your project. If you like you can use the Properties window to give the class module a more descriptive name. Declare a public Chart object The next step is to declare a Public variable that will be used as the class name. The variable should be of type Chart and it must be declared in the class module using the WithEvents keyword. If you omit the WithEvents keyword the object will not respond to events. Following is an example of such a declaration Public WithEvents myChartClass As Chart 556 Part V Advanced Programming Techniques Connect the declared object with your chart .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.