clearing a user-defined Type variable
Declare an instance of your type, but don't set any of its values. The
elements of the Type will be the default values (0s or vbNullStrings or Emptys). Then use LSet to set your fillled out Type to the default values. E.g., Public Type MyType L As Long S As String End Type Sub AAA() Dim Filled As MyType Dim Default As MyType Filled.L = 12345 Filled.S = "some string" Debug.Print Filled.L, Filled.S LSet Filled = Default ' set to default values Debug.Print Filled.L, Filled.S End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Martin" wrote in message ... How do I do it in one line of code? Currently I can only go through every defined property and set each (as relevant) to zero, null or zerolength-string. Setting the variable equal to Null or Nothing won't work. |
All times are GMT +1. The time now is 08:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com