The return of an Array function should be assigned to a Variant.

    Dim datoteka As String, datum As String, imeKopirajListe As Variant
The rest of your code should without other changes.