VB and VBA Users Source Code: Empty/Clear UDTs (user defined type) in one assignment
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Empty/Clear UDTs (user defined type) in one assignment
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Wednesday, September 19, 2001
Hits:
2157
Category:
Visual Basic General
Article:
UDTs are a quick and useful storage facility. However, it is not immediately obvious how to empty or clear the data in the type once you have populated it. The following code demonstrates how to clear a UDT: 'Declaration section Private Type User Name As String Address As String Age As Long DOB As Date End Type Private ztUser As User 'Clears the example type holding details on a user Sub ClearType() Dim tEmtpy As User 'Overwrites private type with an empty type ztUser = tEmtpy End Sub Note, for an array of types using the Redim statement (without Preserve) will empty the types.
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder