> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Creating a twinBASIC ActiveX DLL
- URL: https://nolongerset.com/creating-a-twinbasic-activex-dll/
- Published: 2021-04-11T03:15:00.000Z
- Updated: 2026-05-08T13:05:23.000Z
- Description: Okay, twinBASIC. It's time to make yourself useful.
- Author: Mike Wolfe
- Tags: twinBASIC, #Import 2026-05-20 02:59

*To learn more about [twinBASIC](https://www.twinbasic.com/), join me at this year's virtual [Access DevCon](https://nolongerset.com/join-me-at-access-devcon-2021/) where I will be presenting this exciting new project from vbWatchdog creator, Wayne Phillips.*

### Enough blather, let's make something useful

I've written several [articles](https://nolongerset.com/the-twinbasic-ide-vs-code/) [about](https://nolongerset.com/writing-code-in-twinbasic-part-1/) [writing](https://nolongerset.com/writing-code-in-twinbasic-part-2/) and [debugging code](https://nolongerset.com/debugging-code-in-twinbasic/) in twinBASIC recently. But if you're reading this blog, it's probably because you're an Access (or VBA) developer. In which case, you've probably been reading these articles and feeling a bit like the [Bobs in Office Space](https://www.youtube.com/watch?v=StIcRH%5Fe6zQ) asking Tom Smykowski, "What would you say...ya do here?"

## Creating an ActiveX DLL

Now that twinBASIC's [public preview](https://www.twinbasic.com/preview.html) has gone live, let's make something useful with it. We'll start by creating a simple ActiveX DLL that we can call from an Access application.

### Getting started

Begin by following the instructions in the above link to get twinBASIC up and running. Here's a brief checklist of what you'll need to do:

- Install VS Code
- Install the twinBASIC extension in VS Code
- Download the [project files](https://www.twinbasic.com/downloads/twinBASIC%5FmyCodeLibrary.zip) under **Sample 3** \- [**A Simple ActiveX DLL**](https://www.twinbasic.com/preview.html#helloWorld)
- Extract the two files
- In VS Code: File > Open Workspace > `myLibrary.code-workspace` \> \[Open\]

### Build the library

Click the Build button in the bottom right corner of the EXPLORER pane under the TWINBASIC section:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/04/image-46.png)

VS Code: Explorer (Ctrl + Shift + E) > twinBASIC > Build

The Debug Console will show the following output:

```
[LINKER] SUCCESS created output file 'C:\Path\To\twinBASIC_myCodeLibrary\Build\MyTestLibraryProject_win32.dll'
[COMPILER] SUCCESS registered COM classes for file 'C:\Path\To\twinBASIC_myCodeLibrary\Build\MyTestLibraryProject_win32.dll' [this user only]
```

Build complete!

### Open a 32-bit VBA host application

This can be Access or Excel or Word or...you get the idea. The important thing is it must be 32-bit. The current twinBASIC preview does not yet support 64-bit VBA.

### Add a reference to the COM library

- Switch to the VBA IDE (**\[Alt\] + \[F11\]**)
- Tools > References...
- Check the box next to **MyTestLibrary** project
- Click \[OK\]

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/04/2021-04-11-00_56_07-mjw20-gbm15-lan---Remote-Desktop-Connection.png)

### Confirm early binding works

Create a new standard module and add the following code:

```vba
Sub TestEarlyBinding()    
    Dim Obj As New MyTestLibrary
    Debug.Print Obj.MultiplyByTen(42)    
End Sub
```

Now, let's make sure it works:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/04/image-48.png)

Looks good. I can independently confirm that 42 multiplied by ten equals 420.

### Now let's test late binding

Next, let's see if we can use late binding instead of early binding to call the *MultiplyByTen* function.

```vba
Sub TestLateBinding()
    
    Dim Obj As Object
    Set Obj = CreateObject("MyTestLibraryProject.MyTestLibrary")
    Debug.Print Obj.MultiplyByTen(55)
    
End Sub
```

Unfortunately, running the **TestLateBinding** function blew up in my face with the following error on the Debug.Print line:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/04/image-49.png)

That's a super helpful error message, VBA.

After a bit of troubleshooting, I thought maybe I should re-read the current limitations of the twinBASIC preview. Sure enough, I found my answer [there](https://www.twinbasic.com/preview.html):

> ## Current Preview State
> 
> - Late-bound calls to twinBASIC class objects are disabled
> - DllRegisterServer is not currently implemented in built ActiveX DLLs (the IDE registers it appropriately for now)

That second bullet explains why `regsvr32` isn't working and–more critically–why I can't *unregister* libraries using `regsvr32 /u`. 

The IDE *registers* twinBASIC ActiveX DLLs, but I don't see any way to use the IDE to *unregister* previously registered DLLs (which is too bad, because I've managed to register about [four or five similarly-named twinBASIC DLLs](https://en.wikipedia.org/wiki/DLL%5FHell) in the course of testing out the new functionality).

*Image by [Pexels](https://pixabay.com/users/pexels-2286921/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=1868068) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=1868068)*