Read-Only Access

mlopes1

Board Regular
Joined
Jul 14, 2002
Messages
114
I have a template that is set to read only. In the rare occasion a user needs to edit it, I am including an 'override' button that changes the file access to read-write, saves the file, and then changes it back to read-only. The code is:
Sub save_over_click()
Dim answer

If ActiveWorkbook.ReadOnly = True Then
ActiveWorkbook.ChangeFileAccess Mode:=xlReadWrite
End If

answer = MsgBox("Saving over the template is permanent and can not be undone. Do you want to continue?", vbYesNo, "Save Over Template")
If answer = 6 Then
ActiveWorkbook.Save
End If

End Sub

My current problem is that excel warns me that the "FileX.xlt is already in use" when I try to execute the code. Any ideas?

Thanks,

Mark
This message was edited by mlopes1 on 2002-08-23 12:50
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
not sure what your problem is a don't get the warning try this


steve w

Sub save_over_click()
Application.DisplayAlerts = False

'your code

Application.DisplayAlerts = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,962
Messages
6,122,482
Members
449,088
Latest member
Melvetica

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top