2016-09-08 1 views
2

저는 VBA에서 초보자입니다. Word (.dotm)에서 템플릿을 만들었습니다. 30 String 객체를 사용했습니다. 나는 VBA를 처분할지 또는 수동으로 처분해야 하는지를 모른다.VBA는 String 및 Array에 대해 가비지 수집을 제공합니까?

아무도 나에게 제안 해 줄 수 없으므로 추후에 메모리 문제가 발생하지 않을 수 있습니까?

+3

[this] (http://stackoverflow.com/questions/19038350/when-should-an-excel-vba-variable-be-killed-or-set-to-nothing) 대답. – dee

답변

3

처분 할 필요가 없습니다. 문자열 변수가 범위를 벗어나 자마자 메모리가 복구됩니다.

'Globally scoped g will be retained until the project is reset with `End` 
Public g as string 

Sub foo() 
    Dim s as string 
    s = "foo" 

    g = "bar" 

's is destroyed on exiting the sub 
End Sub 

Sub bar() 
    ' Reset the project will reclaim all variables including Globals 
    End 
End Sub