Cannot Change Read-Only Status of Folder for Saving Files in Excel VBA on Windows 11 Pro.

N. Manganaro 0 Reputation points
2024-12-23T17:07:24.3266667+00:00

I'm running Win 11 Pro, Microsoft® Excel® for Microsoft 365 MSO (Version 2412 Build 16.0.18324.20092) 64-bit.
I am having a problem saving a file using VBA now using the code below, although the macro used to work without a problem.
ActiveWorkbook.SaveAs Filename:=toPaths(i), FileFormat:=xlCSVUTF8, _

    CreateBackup:=False

    ActiveWindow.Close  
```I'm getting an error that says "filexyz.csv cannot be accessed. The file may be corrupted, located on a server that is not responding, or read-only."  
  
If I stop the macro, I can manually save the file where I want.

  
I checked the properties of the folder where I want to put it, and it says it's read-only. If I un-click the read-only box, even acting as an administrator, that change is not permanent. If I go look at the properties again, it says it's read-only.  
I also made sure I had read-write control on the folder, but that does not stay set as I want it.

What can I do?

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
2,048 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,103 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.