Hello again forum, I posted earlier about a project I was undertaking and was wondering if anyone could help again please
I am creating multiple workbooks, using a loop and pasting data into each of them in turn and saving them. Every now and again I get an error message pop up on screen
" Run-time error '1004': Method'SaveAs'of object'_Workbook' failed"
Though it doesn't always do it, and I can not find a common denominator as to why, the code I am using to save each file is as follows:
"
I have read somewhere that ActiveWorkbook.Saveas could be the problem, but as I have nearly 190 different files to save it would be difficult for me to name each and every one.
Has anyone encountered this before?
My prior thread to give some context:
http://www.mrexcel.com/forum/excel-questions/869688-if-two-cells-equal-mark-unique.html
I am creating multiple workbooks, using a loop and pasting data into each of them in turn and saving them. Every now and again I get an error message pop up on screen
" Run-time error '1004': Method'SaveAs'of object'_Workbook' failed"
Though it doesn't always do it, and I can not find a common denominator as to why, the code I am using to save each file is as follows:
Code:
Workbooks.Add
ActiveSheet.Paste
Supplier = Range("B2").Text
ActiveWorkbook.SaveAs Filename:="H:\invoiceMacroWork\Suppliers\" & Supplier & ".xlsx"
ActiveWorkbook.Close True
Set rng = Nothing
Next i
I have read somewhere that ActiveWorkbook.Saveas could be the problem, but as I have nearly 190 different files to save it would be difficult for me to name each and every one.
Has anyone encountered this before?
My prior thread to give some context:
http://www.mrexcel.com/forum/excel-questions/869688-if-two-cells-equal-mark-unique.html