You would need to change
Function SumIf3D(Range3D As String, Criteria As String, _
Optional Sum_Range As Variant) As Variant
To
Function SumIf3D(Range3D As String, Criteria As String, _
Optional Sum_Range As Variant,Optional WkBkFileName As Variant) As
Variant
For it to be useful you would also need to make use of the WkBkFileName later
on in the code.