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.
Related
I made a workbook with VBA which is stored at shared folder of my employer. Employees can open this folder and workbook, but only as read-only.
User at this workbook works with several macros and I need to count number of starts these macros and store this data somewhere. In the best way, it will be stored in the workbook itself. But they do not have rights to modify the workbook, so they cannot save it even if I will try do it automatically as part of macro.
So what I need, is to find a way, how to make this workbook self editing (or auto-saving).
I found two possible ways, but they do not work at this scenario:
Because the file is opened just in read-only mode, I cannot save it directly. I even cannot use save-as and rewrite that file, because I haven't rights to editing it in that folder.
I found a way, where is new document in PC repository and the workbook saves data in that file and this file must be saved somewhere, where it could be editable. But I do not know networking enough to find a save place where I will make this file and even more, I am not sure, how will HQ looks at this type of activity.
I would prefer to count it in the file, but from MS support I get, that I cannot save it, just rewrite, which is impossible if I have not rights for that. So my question is, is there any save way how to count it or store data somewhere else?
As far as I know, without getting write-permissions fixed for your users, it can't be done. You should work with your network administrator to explain your requirements for the users.
Alternatively, you need to find a place where every user DOES have write-access, then design the script to save-as to that location. It all comes down to permissions.
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 need to create a button in Excel that opens a dialog box and I select the file that I recorded on the second sheet, but I also automatically select other files with the same name differs just ending. So I need to choose one file, and always record 2-3 more with the same name and to open a new worksheet. How to do it?
What you need to select the file abc.txt and uploaded to other files abc.ydd and abc.dyk name will always be the same only the ending will be different.
An advice for any work you are doing: Break down your big task into small steps as often as needed until the steps are small enough so that you know how to process them.
On your specific programming task, this means, you should break it down into:
You need a button on one of the excel sheets.
That button has to open a dialog box for selecting a file
I don't know whether it can be any arbitrary file or a specific one, as you wrote that the file was recorded on another sheet. I think that makes no difference at all.
After finishing the file selection, you have to evaluate the result of the dialog box (OK -> which file, ABORT -> do nothing).
Take the file name, remove the extension and search for other files (in the same directory or elsewhere) with that name.
I don't know why you want to open another worksheet. Of course you can do that, but if you want to show the content of that files in the worksheet, they better be excel files.
How you do these suggested steps is something you need to find out by yourself. Or you are lucky and find someone else who has plenty of free time to do that for you, but I don't think you will be that lucky, especially after providing a quite vague description of your problem.
In general, stackoverflow is for asking for solutions to specific programming problems, not for providing ready-to-use solutions for beginners. Take a look at VBA manuals and tutorials. They can be found widely across the internet and in book stores.
Does anyone know a way to recover changes made in a .csv that were not saved when excel 2007 was closed.
At the moment, I don't see any way to solve this.
Check all the temporary files created recently. Especially alongside the file you opened. There are a few temp folders in the system that Excel may use. C:\Windows\temp is the main one, but it is usually under the Users folder in later versions of windows. Eg: C:\Users\YourUserName\Local Settings\Temp
If you find any files that look like Excel temps, take a copy and rename the extension and then try to open it.
(Your only real chance is if auto-save kicked in and saved a copy - to a temp file - when you still had your new changes in the document. Otherwise the changes are lost I'm afraid)
If option #1 doesn't resolve your problem in Excel, go to File->Options->Save. Hopefully your AutoRecover file location, under the third box, will be populated with an address.
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?