C
Candyman
I run an application that opens another file, generates a report, then saves
to another 2 directories. Part of that save is to a historical directory,
then to the "Current" directory. I believe the system is crashing because
there is an existing file in the folder. It creates some LOG then closes
Excel completly.
If I clear the folders then it runs perfectly. The files are created. If i
uncomment the SetAttr line then it gives me a "cannot find file" error and
stops the code.
1) How do I get around the system crash?
2) How do i set file attribute to read only?
I am using:
RptName = ThisPath & "\" & "Reports" & "\ " & RptName & " " & Format(Date,
"yyyymmdd")
Application.DisplayAlerts = False
Application.DisplayAlerts = False
Sheets(ChannelName).Move
ActiveWorkbook.SaveAs Filename:=RptName
' SetAttr RptName, vbReadOnly
to another 2 directories. Part of that save is to a historical directory,
then to the "Current" directory. I believe the system is crashing because
there is an existing file in the folder. It creates some LOG then closes
Excel completly.
If I clear the folders then it runs perfectly. The files are created. If i
uncomment the SetAttr line then it gives me a "cannot find file" error and
stops the code.
1) How do I get around the system crash?
2) How do i set file attribute to read only?
I am using:
RptName = ThisPath & "\" & "Reports" & "\ " & RptName & " " & Format(Date,
"yyyymmdd")
Application.DisplayAlerts = False
Application.DisplayAlerts = False
Sheets(ChannelName).Move
ActiveWorkbook.SaveAs Filename:=RptName
' SetAttr RptName, vbReadOnly