Set a type in VBA to nothing?

后端 未结 7 1279
隐瞒了意图╮
隐瞒了意图╮ 2021-02-12 10:40

I have defined a variable with an own type, say

Dim point As DataPoint

Public Type DataPoint
   list as Collection
   name as String
   number as Integer
End Ty         


        
7条回答
  •  庸人自扰
    2021-02-12 11:01

    You can benefit from the fact that functions in VB have an implicit variable that holds the result, and that contains the default type value by default.

    public function GetBlankPoint() as DataPoint
    end function
    

    Usage:

    point = GetBlankPoint()
    

提交回复
热议问题