 | 就是在 Sheet 上放幾個 CHECKBOX,之類的 OLEObjects。 然後在 VBA 中如何取得它們的狀態?
Excel 2000 中運行這個例子並無作用,是我的 Excel 有問題,還是代碼出錯?
Sub Main()
i = 2 Sheet1.Range("A1").Value = "Name" Sheet1.Range("B1").Value = "Link Type" For Each obj In Worksheets("sheet1").OLEObjects '調試發現,此段代碼沒有被執行,未能取得控件屬性。 Sheet1.Cells(i, 1) = obj.Name If obj.OLEType = xlOLELink Then Sheet1.Cells(i, 2) = "Linked" Else Sheet1.Cells(i, 2) = "Embedded" End If i = i + 1 Next
End Sub
|
|