-
Thought it about time I tidied up my coding. I know you can use:
Code:
Dim WrdApp as Word.application
Dim StrCaption as string
'some code here
Set WrdApp = Nothing
Set StrCaption = nothing
To unload the variables at the end of a sub to free up ram & virtual memory, make tider code & speed the rest of the program up. Fine.
Now, how the @#{>/~!!!! do you unload an integer??? I've tried:
Code:
Set i = nothing
i = nothing
unload i 'which I should've guessed wouldn't work.
I just can't get rid of them! (i above is an integer variable by the way). Thanks! :)
-
Just set it at '0' this will reinitialise it. If it is a procedure level variable it will be destroyed on exit of the procedure.
Code:
'Numeric:
intNum = 0
'String:
strText = vbNullString
'Array:
Erase arrData
'Object:
Set objItem = Nothing
:cool:
-
You do not need to set any of the intrinsic data types to Nothing. This is only for object pointers.
Integers (and Strings etc.) will be automatically disposed of. Setting it to zero will not really do anything (except change the value).
Cheers,
P.
-
Thank all, will bear that in mind.