문제

In Excel 2007 I have the following very simple code in VBA:

Public Type specType
    sb As Long
End Type


Private Sub MyButton_Click()
    Dim spec As specType

    '...
End Sub

When the button is clicked, i get a "User-defined type not defined" Error on the "Dim spec As specType" line... why? Do I have to move my user defined types to a special location?

도움이 되었습니까?

해결책

Turns out Types have to be defined before any functions in the module, otherwise they simply won't be recognized (without giving you an error).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top