Tag: VBA
-
Export Android contacts contacts2.db to vCard vcf on Windows
The other day I need to restore some contacts on an Android phone, I hadĀ Titanium Backup files, though restoring the contacts through there didn’t seem to work. I searched for a solution but there wasn’t really anything for Windows to restore the contacts so I developed my own VBA script. I will assume you already…
-
VBA/VBS check if printer is installed
Here is a quick code snippet to determine if a printer is installed on a Microsoft Windows system;
-
VB functions for determining red/black numbers on roulette wheel
Here are two simple functions for calculating if a number falls on red or black on a roulette wheel, for the perfectionists that don’t want to use odd/even.
-
SplitExtended – improved VB split function with group characters
Based on SplitEx by Chip Pearson, SplitExtended is optimised to be over double the speed, with fixes and additional features; Features over the standard VB Split are; grouping characters, no longer split strings in quotes, ignore consecutive delimiters, while preserving those inĀ grouping characters, option to remove grouping characters, start and end quotes can be…
-
Longest Common Subsequence implemented in VBA (Visual Basic for Applications)
From Wikipedia, The longest common subsequence (LCS) problem is to find the longest subsequence common to all sequences in a set of sequences (often just two). The following is a VBA implementation of this problem. The following functions are included; String functions; longestCommonSubsequence – calculate an LCS array. backTraceUp and backTraceLeft – trace back either…
-
Optimizing/faster String Concatenation in VBA
There are numerous links about Visual Basic string concatenation, one particular is Microsoft’s How To Improve String Concatenation Performance. But the article is overwritten for the point it is trying to make, so I will share a simplified example. Lets say we want to perform the following concatenation: This takes approximately 6000 ticks. The faster…
-
Word Minimize/Maximize event capture VBA
Here is a quick little post outlining how to create a minimize/maximize event routine. Add the following code to a class named EventClassModule and then add the following code under ThisDocument
-
VBA automatically saves Excel 2003 Workbook in compatibility mode as Excel 2007 Workbook
Lets say you have a neat little Excel 2003 macro, when you run your macro in Excel 2007, Excel runs it in Compatibility Mode, and any benefits (such as the 16384 columns) you were hoping to use are still unavailable. So how can we enable these benefits depending on the Excel version? Simply by including…
-
Rigid file manipulation functions for VBA/VBS
Ever since starting work I have been learning and using VBA/VBS to make life easier. I will start posting some of my generic functions as a source for others. They may not be written optimally, but they do work.