Releasing Objects in Functions
<p>I have read countless times that you should always release objects at the end of your projects, such as:</p>

<pre><code>Sub Test()
    Dim obj As Object
    Set obj = GetObject(, "xxxxxx.Application")

    ' Code your project...

    Set obj = Nothing
End Sub
</code></pre>

<p>However, I use a program that calls upon Excel's object. I call Excel's object so often in so many different routines, I decided to make a function to make things simpler:</p>

<pre><code>Public Function appXL As Object
   Set appXL = GetObject(, "Excel.Application")
End Function
</code></pre>

<p>Although that is an extremely simple function, there is no way for me to release the object <code>appXL</code> at the end of any subroutine I use, at least as far as I am aware. But a bigger concern that I have is that a subroutine that uses <code>appXL</code> 100+ times is actually grabbing the object the same number of times.</p>

<p>I honestly don't see why it would be a big issue since I am using <code>GetObject</code> as opposed to <code>CreateObject</code>. I am not creating a new instance of Excel everytime the function is called, so is this something that I should be concerned about when coding? Do I just need to completely get rid of the function and declare <code>appXL</code> on every routine I use so I am able to release it in the end?</p>