Having a array-only based solution isn't so trivial, if you're interested in catching possible errors.
Remark: Instead of just returning an empty array or the input array like in this example, you should raise an error if the input isn't proper. But this depends on how you like the function to behave.
Public Sub Test()
'Some common tests:
Debug.Assert Join(RemoveItemByIndex(Array(), 1), "-") = vbNullString
Debug.Assert Join(RemoveItemByIndex(Array(1), 0), "-") = vbNullString
Debug.Assert Join(RemoveItemByIndex(Array(1), 1), "-") = vbNullString
Debug.Assert Join(RemoveItemByIndex(Array(1, 25, 12), 1), "-") = "1-12"
Debug.Assert Join(RemoveItemByIndex(Array(1, 25, 12), 10), "-") = "1-25-12"
Debug.Assert Join(RemoveItemByIndex(Array(1, 25, 12), -1), "-") = "1-25-12"
Debug.Assert Join(RemoveItemByIndex("foo", -1), "-") = vbNullString
'Your working sample:
Dim originalArray() As Variant
originalArray = Array(1, 25, 12)
Dim item As Variant
For Each item In RemoveItemByIndex(originalArray, 1)
Debug.Print item
Next item
End Sub
Public Function RemoveItemByIndex(ByVal arrayToWorkOn As Variant, ByVal indexToRemove As Long) As Variant()
RemoveItemByIndex = Array()
If Not IsArray(arrayToWorkOn) Then Exit Function
If Not IsArrayInitialized(arrayToWorkOn) Then Exit Function
If UBound(arrayToWorkOn) - LBound(arrayToWorkOn) = 0 Then Exit Function
RemoveItemByIndex = arrayToWorkOn
If indexToRemove < LBound(arrayToWorkOn) _
Or indexToRemove > UBound(arrayToWorkOn) Then Exit Function
ReDim resultingArray(UBound(arrayToWorkOn) - 1) As Variant
Dim index As Long
Dim resultingIndex As Long
For index = LBound(arrayToWorkOn) To UBound(arrayToWorkOn): Do
If index = indexToRemove Then Exit Do
resultingArray(resultingIndex) = arrayToWorkOn(index)
resultingIndex = resultingIndex + 1
Loop While False: Next index
RemoveItemByIndex = resultingArray
End Function
Public Function IsArrayInitialized(ByVal arrayToWorkOn As Variant) As Boolean
On Error Resume Next
IsArrayInitialized = IsArray(arrayToWorkOn) And _
Not IsError(LBound(arrayToWorkOn, 1)) And _
LBound(arrayToWorkOn, 1) <= UBound(arrayToWorkOn, 1)
End Function
Regarding the : Do and Loop While False:: This is a neat trick to simulate a 'continue'.
See here for more information: VBA - how to conditionally skip a for loop iteration