top of page
The VBA Help blog
Search
Calling methods and properties by name in VBA with CallByName
Sometimes you don't know until run time which method to call ... the name's sitting in a cell, a file, a registry key or a button's Tag. VBA's CallByName turns that String into a call: getting or setting a property, or calling a method, by name.
Jun 233 min read
Â
Â


Expand / un-expand environment variable strings
Expanding and unexpanding environment strings using the Windows API.
Feb 272 min read
Â
Â


Creating sentences and lists from a series of items
Often, especially when creating text to show to a user in a dialog, I have a Collection or Array of Strings that I want to use to inform the user of some information. Code to compile those Strings into "clean" user-friendly text can be a pain to write ... for example, making sure the penultimate and last items are delimited by "and" instead of a comma especially when you don't know how many Strings will be included from the off.
Jan 62 min read
Â
Â


Multi-line input box
The standard VBA.InputBox (and Application.InputBox, available if working in Excel) only allow you to enter a single line of text. What to do if you want to allow a user to enter multiple lines of text? Use a UserForm with a multiline TextBox ...
Dec 4, 20253 min read
Â
Â


String interpolation
Interpolation means 'inserting one thing into another'. In this case, inserting one (or more) 'sub' Strings into another 'main' String.
Apr 7, 20253 min read
Â
Â


Add a "GetEnumAsString()" Function
Get the name of an Enum member, not its value using the 'Add a "GetEnumAsString()" function' ... automatically added by VBE_Extras.
Jul 1, 20245 min read
Â
Â


Extract literal values (Strings, numerics, dates) to a constant in VBA
VBE_Extras includes functions for 'Matches for literal value at cursor' and 'Extract to constant' which are closely related.
Jul 25, 20232 min read
Â
Â


Sorting Strings in VBA
This is an implementation of the 'merge sort' algorithm - one of the most efficient sorting algorithms. It uses what's known as a 'divide...
Jun 13, 20232 min read
Â
Â


Articles: Blog2
bottom of page