Enter modify password after opened

plimoman

New Member
Joined
Oct 22, 2012
Messages
5
I have a few Excel files that I configured with a read-only and different write access passwords. I was wondering if there is a way to go from read-only to write mode while the file is open, instead of having to close the file, reopen enter the main password then enter the password for write access. It would be nice to go from read-only to write so I can make the changes needed and return to read-only.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
In general it could be done with VBA, however, when a file is ReadOnly, Excel (also) needs to close the file and to open it afterwards.
Besides that Excel can crash due to memory issues, despite the fact that there is more than enough memory.
The code below is in a 21 KB file on a machine with 16 GB of memory (2.3 in use), still Excell (2013, 32 bits) argues about not enough available memory.
VBA Code:
Sub Example()
    With ThisWorkbook
        If .ReadOnly Then
            .ChangeFileAccess xlReadWrite
        Else
            .ChangeFileAccess xlReadOnly
        End If
    End With
End Sub
 
Upvote 0
Thank you for the reply. I guess since its not as simple as I would of hoped I will stop being lazy and just close and reopen.


In general it could be done with VBA, however, when a file is ReadOnly, Excel (also) needs to close the file and to open it afterwards.
Besides that Excel can crash due to memory issues, despite the fact that there is more than enough memory.
The code below is in a 21 KB file on a machine with 16 GB of memory (2.3 in use), still Excell (2013, 32 bits) argues about not enough available memory.
VBA Code:
Sub Example()
    With ThisWorkbook
        If .ReadOnly Then
            .ChangeFileAccess xlReadWrite
        Else
            .ChangeFileAccess xlReadOnly
        End If
    End With
End Sub
 
Upvote 0
Could work with a Personal.xlsb containing the macro, password protected of course. The file is always loaded as the very first thing of launching Excel. Read at.
Got one permanetly loading a custom ribbon with 2 dozen or so custom buttons with assigned macros, plus it executes some stuff to set up the environment.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,432
Members
448,961
Latest member
nzskater

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