I am looking to encrypt a file to require other users to enter a password before opening it. If I didn't have macros in my file, this would be very easy (file, protect workbook, encrypt), but I am getting an error that I cannot do this with my macros in place. How do I go about encrypting the file (I am brand new to coding, so I also need instructions on where to place the code etc.)
I found a video that let me protect sheets, but didn't encrypt them. I also tried the code at the bottom of this link, but I was getting errors stating that various aspects of the code were not defined.
https://answers.microsoft.com/en-us/msoffice/forum/all/workbook-encryption-with-macro-help/c0dd3057-7d4e-4b6a-a3c0-a2b66cd4d292
How do I accomplish this (seemingly) basic task?
Thank you!
Related
I have used ag-grid master-details data rendering, and using export functionality. After downloading excel file, when I try to open file, its giving warning, "We found a problem with some content in 'FileName.xlsx'.Do you want us to try to recover as much as we can? If you trust the source of this workbook, Click Yes". On window OS, file get recovered but on Mac, file is not getting recovered.
It's probably a good idea to take over control of the export functionality by handling the export on the back-end. There are libraries for most languages for writing Excel files.
Is there a possibilty to prevent a user from sending an excel document while it is still opened?
I had to make my document clear certain cells (containing personal data/personally identifiable information). I succesfully did this by using a function that generates a prompt before saving and only saves (and clears the respective fields) when accepting and doesnt do anything when canceling).
However, users can still send the opened document that contains the critical data.
I know it's a stretch, but is there a possibility to prevent this?
Like, with some sort of checksum/encryption shenanigans that corrupts the document while opened, thus rendering a sent copy in this state useless/not accessible/broken. The document would only be "fixed" again when saving (thus erasing the critical data too).
I can only imagine something like this, because forbidding other programs to read an opened excel document seems crazy.
Any help is greatly appreciated. Thanks in advance!
And hello to everyone here! (first post) This place is a lifesaver.
EDIT: For clarification:
1. Users get the excel document.
2. They enter personal data of staff/applicants etc. into it and my document does fancy stuff.
3. An output is generated which needs to go into some other tool.
4. The excel document's purpose is fulfilled and it must clean itself from filthy personal data.
This is achieved as described before. Saving etc. is all sorted out.
The problem I have been told to deal with, is to make it impossible to send the document while it still contains personal data. Closing wipes it, but while open, it still does contain personal data and can be interacted with Outlook etc.
Is there a way to prevent this kind of interaction with the document while still open? Or make the document corrupt while open, so copying it in this state won't transmit any personal data?
and welcome.
Your question is a bit of a strange one and I am not sure what would be the perfect way, but let me try answer and give you some suggestions:
A: You could work with a codeword in a specified cell. When you save a file it will put the word in that cell. When the word is not there.....well, let's say you can create some macro in Workbook.Open event that will delete all cellvalues and saves the file on its current location. Obviously put password on vba coding!
B: A more solid way in my opinion is to work on the file in your personal workspace if possible and upon saving the file create a copy to the shared folder through vba.
Good luck with it.
A: Manipulating the checksum/temp encryption would be quite risky since if your code crashes or is halted and closed the file is either corrupt or encrypted for you aswell, so information might be lost.
B: You could make the file copy to a temp while editing.
C: You can maybe block the save/autosave function of excel so that your editing won't get saved half-way in. (Not really a good solution, but a solution, likely quite easy).
EDIT:
For option C:
Insert this to workbook, it runs as it's named, before save.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
//INSERT INSTRUCTION TO REMOVE PERSONAL DATA
End Sub
With this, data is removed before file is saved, so any saved state should be clean. Macro-deactivated workbooks however, cannot solve this problem, so you should maybe also add an event at workbook open that unlocks the sheets via VBA to avoid that flaw.
I have a 20 excel files with Automation written in VBA where the workflow is similar but there is some customizations in each of the files. I would like to have 20 files, each file per task, but I would like to put all macros into one file, with all the customizations. This will simplify fixing/changing the automation.
I want to have basically one file GlobalMacros.xls somewhere in a shared drive which contains all the modules that do not contain customizations, and only have references to it in the proper files.
Personal.xls is not an answer as I do not want users/team members to feel the changes at all.
Please tell me if there is a solution and what are downsides.
Solution 1:
My solution is to make the module in GlobalMacro.xls and then add just a reference to the module in each file. The downside is it could slow down the execution of the macros because the GlobalMacros.xls will be opened and closed in the background each time any module is called out. Also is it possible for several users using these macros at the same time?
Has anyone got any better solutions? Maybe someone had a similar problem in the past.
I'll go into a bit more detail about how to use XLAM files properly.
In a network environment, you will want to keep a local copy of the XLAM where you make changes and updates, and once all glitches are worked out, you then copy it to the server where everyone else accesses it. You will want to also make the server copy read-only, which must be reset each time you copy the file to the server. If you dont make it read-only, you will not be able to copy the updated file to the server while anyone has Excel currently open.
In addition, when the users add the Add-On to their Excel, they will be prompted to copy the XLAM file to their local computer, to which they should reply No, as they want to be able to run off the server copy so they can get your updates. I have found that most people instinctively think they should answer Yes to that question.
If they end up answering Yes, then the only way to fix it is to edit thier registry and remove the reference, and then re-add the Add-On.
I would like to sell an Excel file online. The main security goal is: one user / download.
I thought of an individual license key per download combined with somehow restricting the user to copy the content of the Excel file but at the same time make it possible to add content.
Any suggestions how to accomplish that or even have a better idea to solve the problem?
I would appreciate any help!
Look at LockXLS. I've used with some success. As others have mentioned, there is no built in way to protect your spreadsheet. Anyone can google how to use a hex editor to unlock Excel sheets and be on their merry way with your hard work in a matter of minutes, even if you are using some sort of vba protection. LockXLS is the best way I found to adequately protect a spreadsheet, but it does come with its own set of quirks. Download the trial and try it out. http://www.lockxls.com/product.asp
Apologies if this is in the wrong site.
A while ago I placed a password onto my Excel document, and I have never looked at it again until recently and discovered that I can no longer remember the password. I have tried the following:
Entering VB code - However in order to be able to enter the VB code you must enter your password. This proved no such luck.
Zipping the file, and then un-zipping to gain access to the .xml file to edit the protection, this file, seemed just corrupt and contained an error within the xml / the xml did not show up when opening it in a XML editor.
I'm completely at a loss as to what I can actually do and this document is of importance and I need to edit it. Does anyone have any suggestions to what I can try in order to solve this?