简单自定义types的“用户定义types未定义”

在Excel 2007中,我在VBA中有以下非常简单的代码:

Public Type specType sb As Long End Type Private Sub MyButton_Click() Dim spec As specType '... End Sub 

当button被点击,我得到一个“用户定义的types没有定义”错误的“昏暗spec spec as specType”线…为什么? 我是否必须将用户定义的types移动到特定位置?

结果types必须在模块中的任何函数之前定义,否则它们根本不会被识别(没有给出错误)。