Is it possible via VBA to save a read-only to same name - that is tosuspend the read-only status?What I have is a workbook, that users opens read-only. In some situationVBA adds data to the workbook, and changes should be saved.
There is no easy answer AFAIK. You cannot Unset ReadOnly status.I would work along the lines of saving the workbook under a new name (say"Newname.xls) and then saving it again under the old name but I think thiswill not work directly (it might though!). I suspect Excel hangs onto the filelock on the old file until the renamed file is closed.If my suspicion is correct I would tryCreate a new module inCreate a macro in personal.xls to do the following*********Close Newname.xlsUse the fso to: delete the old file andrename newname.xls to the old file nameopen the file (as R/O if required)************You would need to pass the old file name to the macroas a parameter so save it to a variable before savingthe file as newname.xls.If this does not work (because Excel still hangs onto thefile lock on oldfile even after newfile is closed you wouldNeed to code a vbs script to do the same thing but toDo it by closing Excel first.Obviously I have not tried this but I hope it sets you on thePath to solving your problem.
I'll give it a try.......................