Dim 变量 as 类型 ‘定义为局部变量,如 Dim xyz as integer
Private 变量 as 类型 ‘定义为私有变量,如 Private xyz as byte
Public 变量 as 类型 ‘定义为公有变量,如 Public xyz as single
Global 变量 as 类型 ‘定义为全局变量,如 Global xyz as date
Static 变量 as 类型 ‘定义为静态变量,如 Static xyz as double

Related Posts: VBA 定义不同类型的变量 :