Is `Range.Formula` a COM object?

74 Views Asked by At

In other words do I need to release it with Marshal.ReleaseComObject()? I know Range is and it needs to be released but I am not sure about the Formula.

1

There are 1 best solutions below

2
On

In the Excel object model Formula is a string, not an object.

A simple test in Excel VBA:

Sub test()
    Dim R As Variant
    Set R = Range("A1")
    Debug.Print TypeName(R)
    Debug.Print TypeName(R.Formula)
End Sub

It prints:

Range
String