Access settings stack in VBA

This is a similar piece of code as the ExcelSettingsStack posted earlier.

It does pretty much the same thing, but has some differences due to Excel settings being read/write and Access settings mostly being write-only. It provides the same two base functions; Push and Pop. The Push function stores the provided settings (or current settings for all optionals left blank) and sets them. Upon Pop, the previous settings on the stack are restored. If settings are write-only, the previous value on the stack is used as the current setting. The current setttings can be retrieved through the Last property.

Continue reading

Excel settings stack in VBA

Often if procedures are called from existing code they change these settings, which makes it hard to track the current settings when a call returns. This code provides a stack to be used for Excel Application based settings, it provides two base functions; Push and Pop. The Push function stores the provided settings (or current settings for all optionals left blank) and sets them. Upon Pop, the previous settings on the stack are restored.

Continue reading

Modulo 11 checksum verification in VBA

Modulo 11 is a method to calculate checksums or verification digits to numeric data. Its used extensively throughout the world in cases such as bankaccount numbers, creditcard numbers, ISBN numbers and the like. The basic idea is not as much encryption or something similar, but more a protection against human errors. By calculating and verifying the checksum you can quickly detect cases like changing a single digit, switching digits, missing a digit, etc. By verifying a number as early as possible, you can decrease the amount of rubish entering a business process, and hence ease operations.

Continue reading

Storing data in a Base64 encoding using VBA

Here’s some code that I’m pretty proud of, its a nifty piece of code that allows to store any kind of data in a simple textbased container. It uses a custom Base64 encoding to store integers, floats, strings, booleans or blobs in a text block and adds some CRC checks and even some repair capabilities.

Continue reading

INI style settings in a string using VBA

In VBA you may occasionally want to store some settings outside of the document. The registry is one way, but I often try to keep it in INI files as automated documents get spread through email easily, but usually do not get ‘uninstalled’ hence the settings will never be cleaned up. I’d rather leave an orphaned file than polute the registry. Other advantages are that its easier to support because a user can email them, or its easier to edit by a user.

Continue reading

VBA splitter control to dynamically resize controls on a userform

Here’s another post of something I created long ago, yet never got to post. Just trying to catch up here 🙂

While looking for a control myself to achieve this, I couldn’t find any. Some VB6 controls we’re available, yet when distributing spreadsheets or databases I just don’t like to create to much dependencies on external controls. Quite often the support required goes through the roof when external dependencies are used.

Continue reading