twinBASIC Update: December 26, 2022

Highlights include the smallest bug report in twinBASIC history, a repository of twinBASIC sample projects, and a tB-based VBA DocTest runner from Ben Clothier.

twinBASIC Update: December 26, 2022

On April 23, 2021, I helped Wayne Phillips introduce the world to twinBASIC at the Access DevCon Vienna conference.  I boldly predicted that twinBASIC (along with the Monaco editor) would replace VBA and its outdated development environment by 2025.  With that goal in mind, this weekly update is my attempt to keep the project fresh in the minds of the VBA development community.

Every Sunday, I will be providing updates on the status of the project, linking to new articles discussing twinBASIC, and generally trying to increase engagement with the project.  If you come across items that should be included here, tweet me @NoLongerSet or email me at mike at nolongerset dot com.

Here are some links to get involved with the project:


Minor Bug Fixes

It was a relatively quiet week for official twinBASIC releases.  A handful of bug fixes, but no new features.  Not particularly surprising, given the holidays, but that apparently was not the primary reason for the lull...

A Different Kind of Bug Report

Looks like the real culprit was (is?) a very small bug...microscopic even:

Feeling rubbish today, guys... everyone in the Phillips household has come down with the lurgy.  tB updates will be somewhat less regular for a little while.

My fellow Americans, the "lurgy" is apparently a British thing (I had to google it):

  1. (Britain, slang) A fictitious, highly infectious disease; often used in the phrase "the dreaded lurgi", sometimes as a reference to flu-like symptoms
  2. (Britain, slang) Any uncategorised disease with symptoms similar to a cold or flu that renders one unable to work.

Get well soon, Wayne!

Around the Web

Unit Testing VBA Code with twinBASIC

Ben Clothier released a proof-of-concept unit test runner for VBA called tUnitVba.  The GitHub project is available here.  Here's some information from the project Readme:

tUnitVba Proof of concept

A proof of concept demonstrating twInBasic solution running as a VBE add-in to run unit tests. This demonstrates the ability to:

Built with twinBASIC IDE version 178

  • Work with memory directly
  • Obtain ITypeInfos from VBA project which in turn enables access to additional features not exposed via VBIDE addin
  • Allows host-agnostic execution of code
  • Supports the special Print syntax to format the output

This was frankenstein'd together with various code contributions from the following sources & people:

Here is a very rough and simple demonstration:

{visit GitHub to view embedded 1:09-long video; I'll post a few screenshots here to give you an idea of what's included}

The tool installs as a VBIDE add-in.
Hey, I recognize that doc-test syntax. No code changes required for me, thanks Ben!
There are two ways to make a failing test pass: (1) fix the function or (2) fix the test.

My Thoughts

The part that I found most intriguing about this project so far is the fact that it's host-agnostic.  

What does that mean?  It means you can now use the DocTests feature in all of your VBA code, not just Access.  The core of my DocTests function was the Access Application's Eval method.  Since this is an Access-specific feature, my DocTests code only worked out of the box with Access code (you could adapt my original function to create an Access object via Automation if you were really motivated, but I doubt anyone ever did that).

Ben replaces the Eval method that I used with Greedquest's StdModuleAccessor code (an interesting project in its own right that I did not know existed).  

Here's the best part for anyone who's used my DocTests code.  It appears Ben adapted the DocTests syntax that I originally borrowed from Python.  That means you can use Ben's test runner without having to make any code changes to your existing DocTests.

twinBASIC Sample Projects

I've posted several links to twinBASIC sample projects on GitHub over the past few months.  The majority of these projects have been from fafalone, one of the more frequent commenters of the various twinBASIC discussion boards (GitHub, Discord, etc.).

As it turns out, fafalone has a GitHub account dedicated solely to twinBASIC sample projects.  If you're interested in seeing more real-life examples of using twinBASIC, be sure to give him a follow over on GitHub.


Here are the updates from the past week.  You can also find this information by visiting the GitHub twinBASIC Releases page.

Releases · WaynePhillipsEA/twinbasic
Contribute to WaynePhillipsEA/twinbasic development by creating an account on GitHub.

WARNING: The following two issues are present in BETA builds 202 - 213 (the latest build as of publication):

  • building ActiveX controls is known to be broken in these builds.  Use BETA 201 instead for that feature.
  • there are known memory leaks in these versions, so memory usage will be higher than normal

BETA 211

  • fixed: VariantClear/SafeArrayDestroy behaviour now better matches VBx by ignoring HRESULTs in most circumstances
  • fixed: (regression) compiler crash when entering API declares in some instances [ ]
  • fixed: (regression) licence key change could crash the compiler [ ]
  • fixed: some issues with regards to the internal definition of VBA.ErrObject [ wqweto, discord ]

BETA 212

  • fixed: (regression) x64 generated builds were invalid in BETA 211

BETA 213

  • fixed: AutoRedraw property bug when picturebox or form is resized [ fafalone, discord ]
  • fixed: IDE snapshot renderer no longer sets controls to 0x0 size between renders [ fafalone, discord ]