Hello susanto
Welcome to ExcelFox
Thanks for adding the cross post link.
Having read the conversation with you and yky at mrexcel.com , I think the biggest problem is communicating with you in English. But I will try :
_1) With your sample file, the macro errors in the second loop when trying to copy the .png files to the second Folder, BM 3311 R
I think you have seen that yourself, - on the second loop it errors at
FSO.CopyFile sTmpFolder & "\s" & i & "_files\*.png", sFolder & "" & WS.Name
This seems to arise because your second worksheet tab Name has an extra space character on the end, - its name is
"BM 3311 R "
ExtraSpaceAtEndOfWsName.JPG : https://imgur.com/n1hsLUv
ExtraSpaceAtEndOfWsName.JPG
Do you see that there are 10 characters there. Having 10 characters is not a problem. But the last character having a space seems to cause the problem in the coding.
If you change the file name to .._
"BM 3311 R"
( there are 9 characters there, no extra space at the end )
_.. then the macro does not error , and I can run the macro to completion
_2) Once the macro runs normally, I get correct results. So I am unable to get your problem.
In the oploded file are 3 pictures in each worksheet.
Finally , after running the macro I see two folders, each with 3 .png files in it :
2x3pngPics.JPG : https://imgur.com/rqwHgV3
2x3pngPics.jpg
So I can’t repeat the error….
Alan
Bookmarks