Error 10, “This array is fixed or temporarily locked”, appears when code tries to resize or erase an array that VBA has frozen. The array might be declared with fixed bounds, currently referenced inside a With block, or handed over to something (a control, a library call) that pins it in place. It is a code bug: the resize is aimed at an array that was never meant to move.
Dim a() can be ReDimmed; Dim a(1 To 10) cannot. A ReDim aimed at the second form is error 10 every time.Dim items() As String ' dynamic: ReDim is allowed ReDim items(1 To count) ' Dim items(1 To 10) As String ' fixed: ReDim raises error 10
With arr is active the array is temporarily locked. Finish the With block, resize, then re-enter if needed.Erase on a fixed-size array reinitializes it legally, but on a locked array it raises the same error 10; the lock, not the verb, is the problem.If the array is dynamic and not in a With block, the lock is coming from outside VBA: an array passed ByRef into a DLL call or bound to a form control stays pinned until that call returns or the binding is released. Resize a copy, or complete the external call first.
What does temporarily locked mean in practice? VBA freezes an array while something else is relying on its current memory: a With block referencing it, a control displaying it, or a library call using it. The lock ends when that use ends.
Is error 10 caused by the data? No. The data can trigger the code path, but the cause is structural: code tried to change the size of an array that was declared fixed or is currently locked.