Disable User from Viewing ActiveX Control Property Excel (VBA) - excel

I'm currently building a VBA based application on Microsoft Excel.
I used simple activeX control to get the user ID/password. The problem with this is that the user might be able to view the password's value by viewing the "properties" of the activeX label
Is there any way that I can prevent the user from activating the "Design" mode and seeing the values of the textboxes directly? Or is there any better way to store the credentials on the system? The reason why I use the textboxes is because they are simpler for the user to use (you can save the value and hence you can use the program in the future without the need to retype the userid/password again) and it's simple to maintain (no need forms/popups)
Thank you for your help.
This is how the id/password box on the sheet look like (using activeX control)
The problem is that the user can see the value of the password textbox if they open the design mode -> properties

I would create a UserForm to handle the username/password system. The form could save the username and password to a very hidden sheet by setting the 'Visible' property for the sheet to 'xlSheetVeryHidden' in the VBA IDE. The sheet can't be unhidden unless you go into the VBA IDE and change the visible property.
When the form is opened, load the data from two ranges on that sheet. You can set the range names to be hidden from the Name Manager in case you are concerned about users working out the range names and putting the value into a cell.
The only people who would know what the cell range names are, and where to access them, would be those with access to the VBA code. So protect that with a password and it will be as secure as you can make it in Excel, well at least in my view.
Security is a relative thing in any case. How secure something needs to be depends on how important the data is. If it is just to keep people from messing with things they shouldn't then simple security is fine. If it is highly confidential data then you shouldn't be allowing users to save a password anyway. A username perhaps, but not a password.

Related

Code for the protection of worksheets - unable to be viewed without password for the specific sheet

I'm currently trying to construct a Workbook consisting of several Worksheets. However, the worksheets should be protected in a way so that they can't be opened unless the correct password is given. Ideally each worksheet should have its own password, i.e. if I were to click on say 'Sheet 2' I would have to enter a password in order to actually see the content of that sheet. I'm quite new to VBA and don't even know if this is even possible.
I have tried to solve the problem without VBA, but Excel does not have that kind of feature and only allows for the protection of cells, etc.

Excel Spreadsheet tabs

it sounds simple but I am struggling
Do you know how to password protect a single sheet (there’s multiple sheets in the work book) so that you can only view it with a password. So the user can’t see it with the ‘read only’ option, I can only seem to be able to do it to the whole workbook. But just need it for 1 sheet only?
Thanks
A visually undiscoverable and password-protected sheet. C4 has test, but you can't see it. I also removed gridlines for grins.
I thought about this for a bit, and here's my best answer:
Change the cell and font colors to be the same
Protect the sheet and disable the ability to change ANYTHING.
Hide the sheet, if necessary.
This would force someone to:
Have the password.
Select All fields on that page, and then change the font color.
If memory serves correctly, this can easily be hacked by importing the workbook to Google Sheets, converting it to a Sheet, and then re-exporting it back to XLSX. In other words, don't be trying to hide anything TOO sensitive here.

excel initialize 'protect/unprotect sheet' with a userform

I have made an Excel file in which operators from a manufacturing company can log malfunctions/failures or anything that stops production. The way an operator logs a malfunction, is by clicking on a button on one sheet, that opens a userform created with VBA in Excel.
The operator fills in all the required fields through dropdown menus (operators' name, team, malfunction type, machine name, etc). When the operator is finished, he or she can press on the save button which will write all the data to another sheet in a standardized way, so it is ready to be used for data visualization.
The problem
Some operators do not use the userform to log a malfunction, but type directly into the data sheet, which contradicts the logging of malfunctions in a standardized way. Simply hiding the sheet, or putting a password on it is not an option, because operators must be able to see all the logged malfunctions by others as well.
Possible solution
I have been thinking and the only solution to solve this, is to make the data-sheet readonly. But the problem that occurs then, is that the userform isn't able to put the data into the sheet as well. So i think the best way to solve this, is to put a readonly on the sheet at all times, but when the userform opens, the sheet is unprotected (so it can save the data on the sheet), and when the userform is closed it will be readonly again. Feel free to ask if you need anything.
Thanks in advance.
The Worksheet.Protect method has an option to only stop the user from changing data on the sheet. set UserInterFaceOnly to True:
Worksheet.Protect Password:="randompass" UserInterfaceOnly:=True
Then the code can change the data but the user can't

Protect Excel Slicers

I have a excel file that I need to give to a client. It currently comprises of one worksheet but could easily have many more. On the sheet there is a graph and a selection of slicers.
The problem I have is that if I hand this over to the client, they'll see the underlying code and possibly not need our services going forward.
How do I protect the sheet/file and only allow them to view data and operate the slices without seeing any of the background workings?
They must not be able to save a copy, access the SQL code or save changes.
Thanks,
JJ
You can bolt down excel with the protection options so that people can't edit objects and can only select non-locked items. You can also password protect vba and force read-only open of the spreadsheet.
http://office.microsoft.com/en-gb/excel-help/password-protect-worksheet-or-workbook-elements-HP010078580.aspx
There are lots of protection options available but the best thing you can do is reference a report/webpage with the data on instead of doing a direct db connection. This will alleviate a lot of security risks whilst also blackboxing your database.
IMHO
Only lock your spreadsheet down enough to prevent silly mistakes - combined with your data being a blackbox, they will get a usable spreadsheet and be much happier with you than if they felt you were aggresively trying to withold stuff from them. They may run off with your spreadsheet but the extension of trust to them will help discourage the behaviour and at the end of the day, if someone wants to really harvest your IP, they will do so no matter how many controls you have in place.
you also can try to protect VBAProject at the VBA window, something like this:
and put a password
this way the user can manipulate the worksheet without seeing your code, additional to this, block your worksheet like #StephLocke saids.
Your Workbooks can always be vulnerable, but you can lessen the risk to corrupt your code.
PS. My Excel is Spanish but the options are at the same place.
It is possible to protect the worksheets and still allow to interact with the slicers (and only the slicers).
Set each slicer's properties to not "Locked" by right clicking the slicer and selecting "Size and Properties..." and unsetting the "Locked" property.
Protect all other worksheet elements including cells and Pivot Charts in a similar fashion (set their "Locked" property).
Finally, protect the worksheet via “Review” -> “Protect Sheet” and select "Use AutoFilter" as the only action in the selection "allow for all users of this worksheet to".
You might also confer to this answer.

preventing Excel app from being emailed

I have employees that use a macro/external data enabled Excel file. One of the worksheets in this file contains proprietary data, that is populated from an external data source ODBC connection. This proprietary worksheet is always hidden from the user, because it just serves as a Vlookup-function data-source
I want to prevent my employees from accidentally emailing this Excel file, because I don’t want the hidden worksheet data to be available to non-employees
Please advise if there is anything I can do prevent the email recipient from being able to view the data that is in the hidden worksheet, if the app is accidentally emailed to them.
Are any of the following ideas feasible?:
Password protecting the hidden worksheet, yet, not preventing the Vlookup function from the other worksheet from functioning?
Imbedding something into the app that resembles a virus, to cause all email servers to block the attachment.
Creating a macro that deletes the data from the hidden worksheet when the app is closed
Imbedding large images into the app to make it too large to email, but yet won’t affect the performance.
Please advise, thank you very much in advance, Nathaniel
In regards to number 3, there is a setting like this in the Connection Properties. It's "Remove Data from the external data range before saving the workbook." I'm not looking at XL 2003, but it's nested under the "Refresh Data When Opening the File" option. As others have said, this isn't foolproof, but it might help meet your requirements.
I don't think you can fundamentally prevent your workbook to be sent around. Password-protecting the sheet would be of little help, as it is fairly easy to bypass. The safest approach to protect your proprietary data from prying eyes would be to not have it in the worksheet itself, retrieve it dynamically by prompting the user for some credentials, and never save it in a worksheet.
You can hide the sheet from the developer tab of excel. To do this, follow the steps below
Open the excel
Press Alt + F11
Here you can see the list of sheets on your excel file
Select the sheet that you want to hide
When you select the sheet you can see the properties of the particular sheet below
Set the visibility property to ‘2 – xlSheetVeryHidden’
Now right click on the sheet and select VBAProject – Project Properties
Navigate to the Protection tab and check ‘Lock project for viewing’
Set a password
Sheets hidden in this way cannot be un hidden unless one has access to the VBA Project (but this is now password protected). The sheet can be seen only if you know the password.

Resources