“Method or Data Member Not Found” when Dim'ing Worksheet as Worksheet but not Variant
问题 Consider this simple example. In a new sheet create a ActiveX Checkbox called Checkbox1 Try the following two subroutines. The first does not compile with a "Method or Data Member Not Found" error, the second one works fine. Why doesn't the first example work? Option Explicit Sub DoesntWork() Dim ws As Worksheet Set ws = Worksheets(1) MsgBox "Checkbox state is: " + CStr(ws.CheckBox1.Value) End Sub Sub Works() Dim ws As Variant Set ws = Worksheets(1) MsgBox "Checkbox state is: " + CStr(ws