G
Graeme Richardson
Hi, a project I'm working on is not destroying instantiated objects as
required. I find that decompiling and then compiling the project fixes the
problem. However, if I then edit [enough] code the problem returns.
Manually reordering the references causes Access/VBA to properly decompile
the entire project so that it can be recompiled and the problem goes away.
Reordering references is tedious so I've written the following sub to do the
job. The code runs in the same project as I'm decompiling.
What are your thoughts?
I'm surprised that I'm able to do this.
Public Sub DecompileCode()
' Decompile code by removing and then re-adding references
Dim ref As Reference
Dim intCount As Integer, intTotal As Integer
Dim strFile As String
intTotal = References.Count
For intCount = 3 To intTotal ' Can't remove first 2 references
Set ref = References(3)
' Store info on reference
strFile = ref.FullPath
'Remove the reference
References.Remove ref
' Restore the reference (to last in list)
Set ref = References.AddFromFile(strFile)
Next
End Sub
Thanks, Graeme
required. I find that decompiling and then compiling the project fixes the
problem. However, if I then edit [enough] code the problem returns.
Manually reordering the references causes Access/VBA to properly decompile
the entire project so that it can be recompiled and the problem goes away.
Reordering references is tedious so I've written the following sub to do the
job. The code runs in the same project as I'm decompiling.
What are your thoughts?
I'm surprised that I'm able to do this.
Public Sub DecompileCode()
' Decompile code by removing and then re-adding references
Dim ref As Reference
Dim intCount As Integer, intTotal As Integer
Dim strFile As String
intTotal = References.Count
For intCount = 3 To intTotal ' Can't remove first 2 references
Set ref = References(3)
' Store info on reference
strFile = ref.FullPath
'Remove the reference
References.Remove ref
' Restore the reference (to last in list)
Set ref = References.AddFromFile(strFile)
Next
End Sub
Thanks, Graeme