How to store macros in one file shared among several users? (not PERSONAL.xls) - excel

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.

Related

How to make self-modify Excel workbook in shared folder with read-only permissions?

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.

Excel hangs/crashes while updating external link at file opening

I encountered this weird ass and funny error.
I built a file for data ETL. This one takes in various .csv files, combines them and export new .csv files using VBA. The file is originally named as "xxx Modelling ETL.xlsm". It could be opened normally till one day it hangs or crashes while trying to recalculating something (may be the underground query).
After hours of struggling, I opened the file as a copy (under a new name of Copy of ...). Strangely it ran smoothly, no crash or hang. Then I try rename it by remove the "Copy of" part, then the error occurs again.
I want to share this as there could be someone has the same problem, or someone who could shed some light on this black magic thing.
Some solutions:
Rename the file or move it to local drive instead of Onedrive makes thing works normally again.
Open Trust Center, disable Macro with notification, Trusted Locations, and Trusted Documents. Enable them for specific files when open, not for all.

Sharing an Excel File

I wanted to get this community's feedback on best practices for sharing an Excel file.
I have an Excel file on a Sharepoint site where multiple people are responsible for updating the contents of the file. 3 options come to mind on how to handle this.
There could be a master file which has links to other Excel files, where each user could have their own unique slave version of the file. The user could then edit their slave version of the file and when the master is opened, the links in the master would get updated.
I can add multiple data connections to the master file, such that there is a connection for each slave file.
I've also read about making an Excel file shared, where multiple people can edit the same file at the same time. There seems to be a couple of drawback with this option.
a. The Excel file cannot reside on a Sharepoint site.
b. You are limited to the kinds of edits you can make to the shared Excel file. For instance, you cannot insert or delete blocks of cells. You cannot delete worksheets.
Perhaps there is a better option that I have not thought of. So, I'm throwing this out to the community to see what ideas come back. Thanks.
One approach you may consider is to use version control. By placing the Excel file in a shared library on SharePoint and turning version control on for that library (library settings->version settings) you will now have the ability to use "check in" and "check out". This helps ensure that one person's update is not erased when another person copies their updated file into the same library. In addition, this will also provide the ability to have minor and major versions. Only designated individuals can read/update the minor versions (i.e. editors, approvers, etc.) and major versions viewable only to all others with access to the library.
One other thing, you may need to turn on Publishing services for the site in order to have version control.

Sell Excel file securely

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

Recover unsaved .csv file changes

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.

Resources