error: enum user-defined type no

2019-10-15  本文已影响0人  神农架村姑
sub ...()
  ...
end sub

Public Enum WorkDays
    Monday
    Tuesday
    Wednesday
    Thursday
    Friday
    Saturday
    Sunday
End Enum

Sub test()
    Dim wd As WorkDays
    wd = Monday
    Debug.Print wd
End Sub

运行时提示 compile error: user-defined type not defined
编译时提示 compile error: Only comments may appear after end sub, end function and end property

Solution:

提示说只有注释能写在end后面,所以把定义枚举语句放到最开头所有sub之前就好了

上一篇下一篇

猜你喜欢

热点阅读