>>620

このプログラムの直後に
Workbooks.Open (ThisPath & "\" & strfirstfilename)
があったので、それをsetの前に持ってきて成功しました。

ありがとうございました。