I have run this macro since I remember and it never failed before, today it failed to copy 4 worksheets into a new file, returning a "Permission denied" error
There's no many information about this issue, so what I've tried is pretty much to check that I am running everything on admin user, to run Excel as administrator. However, it only fails with .xlsm files, the others work fine
The code fails on the first line, when the Copy
command is used. It is supposed to create a new workbook with those sheets copied. Instead, the "Permission denied" error shows, and at the end it shows ": \name.temp" where name starts with 'VB' and some numbers after that, the numbers always change whenever I try it again.
Worksheets(Array("POS", "VAL", "COL2(USD)", "COL2(PS)")).Copy
Sheets("POS").Select
Cells.Copy
Cells.PasteSpecial xlPasteValues
Sheets("VAL").Select
Cells.Copy
Cells.PasteSpecial xlPasteValues
Sheets("COL2(USD)").Select
Cells.Copy
Cells.PasteSpecial xlPasteValues
Sheets("COL2(USD)").Select
Cells.Copy
Cells.PasteSpecial xlPasteValues
Does anyone know how to fix this?