Convert a file to read only
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
13-08-21 01:12 PM
I have an excel file (.xlsm) and I want to convert it to read only mode. How to do this ?
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
13-08-21 01:47 PM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-08-21 03:22 AM
Hi Sanjay,
You can try the below code to open any excel in read-only mode.
You can modify this to save as well.
Sub VBA_Open_Workbook_As_Read_Only()
Dim sFileName As String sFileName = "D:\test.xlsm"
Workbooks.Open Filename:=sFileName, ReadOnly:=True
End Sub
You can try the below code to open any excel in read-only mode.
You can modify this to save as well.
Sub VBA_Open_Workbook_As_Read_Only()
Dim sFileName As String sFileName = "D:\test.xlsm"
Workbooks.Open Filename:=sFileName, ReadOnly:=True
End Sub
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-08-21 02:20 PM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-09-21 07:59 AM
@Sanjay Basnet Create a duplicate of any action from Ms-Excel VBO and than use the code given by Murali . It will work , it works for me .
You can follow the steps below.
1. Go to "Open Workbook" page and duplicate it.
2. Go to "Open Workbook - Copy" page and open the "Open Workbook" code stage.
3. Replace the code by this code below and rename this stage and page
Dim wb as Object = GetInstance(handle).Workbooks.Open(FileName:=filename,ReadOnly:=True)
name = wb.Name
wb.Activate()
4. That's all. And you can public this page and use it.
Or you can add any parameters if you need them to do some excel manipulation.
Example
Dim wb as Object = GetInstance(handle).Workbooks.Open(filename,UpdateLinks:=updatelinks,ReadOnly:=readonly1,Password:=password,WriteResPassword:=writerespassword,IgnoreReadOnlyRecommended:=True)
name = wb.Name
wb.Activate()
You can follow the steps below.
1. Go to "Open Workbook" page and duplicate it.
2. Go to "Open Workbook - Copy" page and open the "Open Workbook" code stage.
3. Replace the code by this code below and rename this stage and page
Dim wb as Object = GetInstance(handle).Workbooks.Open(FileName:=filename,ReadOnly:=True)
name = wb.Name
wb.Activate()
4. That's all. And you can public this page and use it.
Or you can add any parameters if you need them to do some excel manipulation.
Example
Dim wb as Object = GetInstance(handle).Workbooks.Open(filename,UpdateLinks:=updatelinks,ReadOnly:=readonly1,Password:=password,WriteResPassword:=writerespassword,IgnoreReadOnlyRecommended:=True)
name = wb.Name
wb.Activate()
------------------------------
Vipul Tiwari
Senior Process Simplification Developer
Amazon
------------------------------
