|
-
Jan 10th, 2001, 05:03 AM
#1
Thread Starter
Evil Genius
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!
-
Jan 10th, 2001, 07:19 AM
#2
Fanatic Member
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
-
Jan 10th, 2001, 07:35 AM
#3
Fanatic Member
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.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Jan 10th, 2001, 07:43 AM
#4
Thread Starter
Evil Genius
Thank all, will bear that in mind.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|