View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Neil Miller[_4_] Neil Miller[_4_] is offline
external usenet poster
 
Posts: 3
Default Type Statements and Memory Release

Thanks again keepITcool - that works great. At the risk of
"overstaying my welcome", I would appreciate you expanding on your
comment that you would not have defined a usertype in the way I
described. As I mentioned earlier in the initial Post, the INI files
get read and written using Get/Put and, to some extent, I am limited
by the datatypes allowed with these types of file.

Your thoughts would be appreciated if you have the time.

Thanks again.........Neil

keepITcool wrote in message . ..
Neil..

I'm not sure I'd have defined a usertype like that..
as it's a memory hog at the best of times..

BUT.. for all problems there must be a solution..

instead of declaring your variables as TYPE
declare m as an array of Type..

THEN redim the array.. et voila!

Dim aCMS() As CMS_iNi_seRveR_boDy_tYpE

Sub MemUsageTest()
dump
ReDim aCMS(0)
dump
Erase aCMS
dump
End Sub




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


(Neil Miller) wrote :

Thanks for your reply keepITcool

The problem is that the Type Statements are not as simple as an array,
e.g.

Public Type CMS_iNi_seRveR_boDy_tYpE
biLlaBlE_eXpenSe_aCtiviTy_tYpE_keYwoRd As String
CMS_dEbuG As Boolean
CMS_qUieT As Boolean
eMaiL_copY_To_aDminiStraToR As Boolean
eMaiL_neW_uSeR_msG As String
eMaiL_rEseT_uSeR_msG As String
eMaiL_suBjecT As String
eXpenSe_aCtiviTy_tYpE_keYwoRd As String
Fee_eArninG_aCtiviTy_tYpE_keYwoRd As String
LpEr As Integer
nExT_cAsE_nuMbeR As Integer
NoN_biLlaBlE_eXpenSe_aCtiviTy_tYpE_keYwoRd As String
sErveR_aCtiviTy_dEscRipTioNs_peR_tYpE(10, 25) As String
aCtiviTy_tYpE_keYs(CMS_maX_uSeR_aCtiviTy_tYpEs - 1) As String
sErveR_Fee_eArneRs(CMS_maX_uSeRs) As String
sErveR_paYmeNt_teRmS(CMS_maX_pAymEnT_tErMs - 1) As String
sErveR_rEgioNs(CMS_maX_rEgioNs - 1) As String
sErveR_sCopE(CMS_maX_rEgioNs - 1) As String
sErveR_uSeRs(CMS_maX_uSeR_aTtribUteS, CMS_maX_uSeRs) As Variant
End Type

These Type Statements are declared at module level and I was hoping
that there was an easier way that erasing each variable or array
within the type.

Thanks for your help.

Neil