Solved

Open Excel read only or modify mode

Posted on 2016-10-10
3
30 Views
Last Modified: 2016-10-30
How can I Open Excel with only one popup and if user enter password "passwd1" I want to open the excel with read only mode and if user enter password "passwd2" then I want to open the excel with modify mode.
0
Comment
Question by:Bharat Guru
  • 2
3 Comments
 
LVL 5

Expert Comment

by:D Patel
ID: 41837894
Your query is going to be answered at here :

https://support.office.com/en-us/article/Protect-an-Excel-file-7359d4ae-7213-4ac2-b058-f75e9311b599

Thanks and Regards,
D Patel
0
 
LVL 6

Accepted Solution

by:
Andy earned 500 total points (awarded by participants)
ID: 41837902
The functionality you ask for isn't built into excel by default, the options you have are below (assuming the sheets are on the same workbook):
You could use the 'Allow Users to Edit Ranges' option in Excel.

Or you could use VBA code such as:

Private Sub Workbook_Open()
Dim sh As Worksheet
For Each sh In Sheets
   sh.Visible = xlSheetVisible
Next sh
Select Case Environ("UserName")
Case "User1", "User2", "User3"
   Sheet2.Visible = xlSheetVeryHidden
   Sheet3.Visible = xlSheetVeryHidden
Case "User4", "User5"
   Sheet2.Visible = xlSheetVeryHidden
   Sheet1.Visible = xlSheetVeryHidden
'etc
Case Else:
End Select
End Sub

It goes in the This WorkBook module and runs when the workbook is opened.
User1 etc. aren't  users actual logon names. You'd need to replace them with the users actual names.

Thanks,
Andy
0
 
LVL 6

Expert Comment

by:Andy
ID: 41865733
Question was answered directly as required by the OP
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now