Forum Discussion

coltartjmcsa3's avatar
coltartjmcsa3
Copper Contributor
Feb 07, 2022

Excel VBA and OneDrive SaveCopyAs

I am running office 365 home on windows 10 both latest versions. I have a project that requires the workbook ("Diddly.xlsm") data to be archived every 6 months to a code generated file name leaving t...
  • JKPieterse's avatar
    JKPieterse
    Feb 09, 2022
    I don't know what the current value of lcFile is when the error occurs?

    If you pass just a file name (no path) to the SaveAs method, Excel assumes it needs to be saved in the active directory. Judging by the error message you showed that seems to be c:\Windows. Users are not allowed to save files there. You must provide the SaveAs method with both the path and a filename.

Share

Resources