Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Clearing all values in a User Defined Type variable | Excel Programming | |||
Help: Compile error: type mismatch: array or user defined type expected | Excel Programming | |||
User-defined data type; Error: Only User-defined types... | Excel Programming | |||
Word.Document - user defined type not defined | Excel Programming | |||
User Defined Type Structure - want it to be variable not numeric literal | Excel Programming |