Unload statement
Removes an object from memory.
Syntax
Unload object
The required object placeholder represents an object expression that evaluates to an object in the Applies To list.
Remarks
When an object is unloaded, it's removed from memory and all memory associated with the object is reclaimed. Until it is placed in memory again by using the Load statement, a user can't interact with an object, and the object can't be manipulated programmatically.
Example
The following example assumes two UserForms in a program. In UserForm1's Initialize event, UserForm2 is loaded and shown. When the user clicks UserForm2, it is unloaded and UserForm1 appears. When UserForm1 is clicked, it is unloaded in turn.
' This is the Initialize event procedure for UserForm1
Private Sub UserForm_Initialize()
Load UserForm2
UserForm2.Show
End Sub
' This is the Click event for UserForm2
Private Sub UserForm_Click()
Unload UserForm2
End Sub
' This is the Click event for UserForm1
Private Sub UserForm_Click()
Unload UserForm1
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기