Hello,
In general, the following lines of code work:
ActiveWorkbook.SaveAs Filename:=mstrBARRA_FILE_PATH & astrAccountName(intAccountCount) & "\" & _
astrAccountName(intAccountCount) & ".por", _
FileFormat:=-4158, CreateBackup:=False
or a slightly different line of code (-4158 vs. xlText...same thing)
ActiveWorkbook.SaveAs Filename:=mstrBARRA_FILE_PATH & astrAccountName(intAccountCount) & "\" & _
astrAccountName(intAccountCount) & ".por", _
FileFormat:=-xlText, CreateBackup:=False
The code loops through and saves several files on a network and works fine except for one account. When it saves one particular account it DOES actually save the file, but gives me the following error.
Run-time error '1004':
Method 'SaveAs' of object '_Workbook' failed
There is nothing unusual about the file or the file name. The data is slightly different, but is otherwise essentially the same as the other files. In all cases (each loop/account/file) the macro is saving over a file that existed from the previous day. I can manually resume next or I could create an error handler to do so. However, the former is annoying as I want the code to run when I'm in bed and the latter wouldn't be the best method for solving this problem.
Again, the code works, but gives me this error even though it did save the file.
This is driving me crazy.
Help!
Thanks,
In general, the following lines of code work:
ActiveWorkbook.SaveAs Filename:=mstrBARRA_FILE_PATH & astrAccountName(intAccountCount) & "\" & _
astrAccountName(intAccountCount) & ".por", _
FileFormat:=-4158, CreateBackup:=False
or a slightly different line of code (-4158 vs. xlText...same thing)
ActiveWorkbook.SaveAs Filename:=mstrBARRA_FILE_PATH & astrAccountName(intAccountCount) & "\" & _
astrAccountName(intAccountCount) & ".por", _
FileFormat:=-xlText, CreateBackup:=False
The code loops through and saves several files on a network and works fine except for one account. When it saves one particular account it DOES actually save the file, but gives me the following error.
Run-time error '1004':
Method 'SaveAs' of object '_Workbook' failed
There is nothing unusual about the file or the file name. The data is slightly different, but is otherwise essentially the same as the other files. In all cases (each loop/account/file) the macro is saving over a file that existed from the previous day. I can manually resume next or I could create an error handler to do so. However, the former is annoying as I want the code to run when I'm in bed and the latter wouldn't be the best method for solving this problem.
Again, the code works, but gives me this error even though it did save the file.
This is driving me crazy.
Help!
Thanks,