View Single Post
  #6   Report Post  
Old February 21st 21, 01:33 AM
Thunderr Thunderr is offline
Junior Member
 
First recorded activity by ExcelBanter: Feb 2021
Posts: 1
Default Path/file access error

Hey guys,

For whoever is gonna read this, I hope this message in this thread after 15 years will help you. I got the same problem and my issue was: copying worksheet manually in the file without any macro was going fine.
But then, if I'd create a macro in a workbook and save it as "*.xlsm", manually creating a copy of a sheet will work fine for me. The thing is, if I would run a code for copying a sheet, it will fail for this file both manually or by the code and it will persist in this file from the point onwards.

I tried a solution I found online and it was to delete everything from `C:\..\user\AppData\Local\Temp` but it didn't help. Also tried relocate it from drive `D:\` where my workbook was placed to the `C:\` drive (both are local) and that didn't help as well.

What helped me is to change the Excel default save path for workbooks. By default before my change it was like this: `C:\Users\%myUser%\OneDrive\Documents` and this folder was shared through the cloud (I got multiple PCs under my Microsoft account), so it seems that when Excel is trying to copy a worksheet in a workbook with VBA project (don't ask me why it was working without one) it's creating a `.\VBXXXX.tmp` file in default save location, but failed to write in it.

I found dozens of them in there, all empty because of I assume the fail to write in them. So I changed my default save path in Excel to `D:\Docs\...` and it finally worked. Hope it will help someone somewhere because I spent heaps of time to resolve this issue.

By the way: my OS is Win10, Excel version is: Microsoft Excel 2016 MSO (16.0.13628.20128) 32-bit.