Hello Friends,
I get the following error when my macro is trying to save the file in Excel 2003. It does not always give this error- at times it runs fine and at times it does not…And if the error comes and I close the excel application entirely and reopen it than the the macro runs without giving any error and nicely saving the file..
Run Tim Error:
Microsoft office excel cannot access the file ‘c:\Program Files\CommonFiles\SYSTEM\msapi\1003\
• The file name or path does not exist.
• The file that you are trying to open is being used by another program. Close the document in the other program, and try again.
• The name of the workbook that you are trying to save is the same as the name of another document that is read-only. Try saving the workbook with a different name.
None of the above options is causing this error. Also this file is accessed from this location:
C:\Documents and Settings\pn\My Documents\projects\Capital (not ‘c:\Program Files\CommonFiles\SYSTEM\msapi\1003\)
This is the part of the code where the error occurs ( ActiveWorkbook.SaveAs FileName:=)
I have no clue why this error comes invariably. Any thoughts are highly appreciated.
Thanks a ton
Peace
I get the following error when my macro is trying to save the file in Excel 2003. It does not always give this error- at times it runs fine and at times it does not…And if the error comes and I close the excel application entirely and reopen it than the the macro runs without giving any error and nicely saving the file..
Run Tim Error:
Microsoft office excel cannot access the file ‘c:\Program Files\CommonFiles\SYSTEM\msapi\1003\
• The file name or path does not exist.
• The file that you are trying to open is being used by another program. Close the document in the other program, and try again.
• The name of the workbook that you are trying to save is the same as the name of another document that is read-only. Try saving the workbook with a different name.
None of the above options is causing this error. Also this file is accessed from this location:
C:\Documents and Settings\pn\My Documents\projects\Capital (not ‘c:\Program Files\CommonFiles\SYSTEM\msapi\1003\)
This is the part of the code where the error occurs ( ActiveWorkbook.SaveAs FileName:=)
Code:
ChDrive "K:\"
ChDir "K:\Caps"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs FileName:= _
"USCapstock" & Format(Now(), "yyyy-mm-dd") & ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
Application.DisplayAlerts = True
I have no clue why this error comes invariably. Any thoughts are highly appreciated.
Thanks a ton
Peace