Duan Yu

Which is more better when I destroy a object?

Discussion created by Duan Yu on Feb 18, 2021
Latest reply on Feb 23, 2021 by Duan Yu

I usually initialize some objects:

Dim swApp as SldWorks.SldWorks

Dim swModel as SldWorks.ModelDoc2

Dim swPart as SldWorks.PartDoc

 

set swApp=Application.SldWorks

set swModel=swApp.ActiveDoc

set swPart =swModel as SldWorks.PartDoc

 

When Macro finish, I destroy these objects.

set swApp=nothing

set swModel=nothing

set swPart=nothing

 

If I only destroy swApp object, can swModel and swPart  release resource?

set swApp=nothing

Outcomes