D
DoctorV
I have an Excel workbook that performs a bunch of steps with Microsof
Query. It has code so it can be saved as a read only file and MOS
IMPORTANTLY it needs to save the file over the top of the existing fil
even if a user has this ReadOnly File named MyFile open open. This ha
to work somehow because they will be saving a fresh copy of this fil
every day. How can I get this to overwrite this file as Read Only eve
if a user has it opened read only Thanks URGENT
Here is my code
Dim fs, f, filespec As String
'filespec
"S:\Links\BISCatalog\TrafficLightReport\Traffic_Light_Report_ReadOnly.xls"
filespec = "O:\Taber_Excel2\MyFile.xls"
Application.DisplayAlerts = False
RemoveAllMacros ActiveWorkbook
If Dir(filespec) <> "" Then
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
f.Attributes = 0
Sheets("MainForm").Select
ActiveWindow.SelectedSheets.Visible = False
End If
ActiveWorkbook.SaveAs Filename:=filespec
f.Attributes = 1
ActiveWorkbook.Close
Application.DisplayAlerts = True
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec
Query. It has code so it can be saved as a read only file and MOS
IMPORTANTLY it needs to save the file over the top of the existing fil
even if a user has this ReadOnly File named MyFile open open. This ha
to work somehow because they will be saving a fresh copy of this fil
every day. How can I get this to overwrite this file as Read Only eve
if a user has it opened read only Thanks URGENT
Here is my code
Dim fs, f, filespec As String
'filespec
"S:\Links\BISCatalog\TrafficLightReport\Traffic_Light_Report_ReadOnly.xls"
filespec = "O:\Taber_Excel2\MyFile.xls"
Application.DisplayAlerts = False
RemoveAllMacros ActiveWorkbook
If Dir(filespec) <> "" Then
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
f.Attributes = 0
Sheets("MainForm").Select
ActiveWindow.SelectedSheets.Visible = False
End If
ActiveWorkbook.SaveAs Filename:=filespec
f.Attributes = 1
ActiveWorkbook.Close
Application.DisplayAlerts = True
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec