-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a settings file for storing user specific options #13
Comments
That's definitely an interesting way to handle saving/restoring user state. I think its strength is that it allows an individual section of code to mess with the only the parts it needs to change and return things back to the way they were found. I have used similar code within a single The ability to fall back to the previous state if the code errors out is also a good idea (assuming it works as expected). I have seen it happen multiple times where code fails after changing those variables, and then I get fooled later that I agree with Mat's Mug that the real test of this code is how it responds to multiple instances of the class. It's very reasonable to have a stack of calls where each one wants to change these variables. As a side note, I would not name that main variable I'll look into getting something like this into bUTL. It's a good general utility class to have. There are a number of spots where the code is changing these variables, and some consistency around it would be good. |
Regarding storing settings, I am torn between two approaches. The first is to store them outside of the add-in in an INI file or something similar. This is a good example of how that would be done. The other approach is to use the hidden sheets inside the bUTL.xlam file to store the settings and save them. This approach has the upside that there are no external files. It also makes it possible to technically load/see/change the settings inside Excel. It makes it difficult to persist settings if there are multiple users or if the add-in is going to be upgraded. It'd be nice to just replace the xlam file and know that everyone will continue to work. I'm probably leaning toward the INI file. I have not taken a major shot at this though yet. I have been incrementally adding/testing functionality as I use the add-in at my new job. |
The INI file is probably the more robust way to go - it might also be a way to store the user's defaults if you need to bring it back in anyway. |
It would be good to create a settings file to store user specific settings. The add-in should detect this file and load it into a general
Settings
class or variable. From there, pieces of code that want to behave different will have the ability to do so.Some initial ideas of settings:
InputBox
or theSelection
for formatting choicesSeries Split
)The text was updated successfully, but these errors were encountered: