For an end user on my team the following subroutine fails to save a CSV file with an error message that states “‘OUTLOOK MERGE DATA.CSV’ cannot be accessed. The file may be corrupted, located on a server that is not responding, or read-only.”
I have included the error message as a screenshot, and the subroutine for reference.
Error Message
Private Sub SAVE()
'
' Creating a new book in which to place schedules
USID = Environ("UserName")
ActiveWorkbook.SaveAs Filename:="C:Users" & (USID) & "Desktop" & "OUTLOOK MERGE DATA" & ".CSV", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveWorkbook.SAVE
ActiveWindow.Close
End Sub
I have yet to be able to reproduce the same error on my end when I run the full VBA module and have not been able to find any answers online that suggest a similar experience/solution. I am definitely very confused, because the subroutine is generating a new file, so why would it be attempting to access something existing? If anyone here has had any similar experiences with Excel VBA, I would greatly appreciate advisement on the solution you found.
Thank you!
Paul S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.