{"id":22563895,"url":"https://github.com/fafalone/helloworldxlltb","last_synced_at":"2026-02-14T19:32:03.504Z","repository":{"id":266778465,"uuid":"899330274","full_name":"fafalone/HelloWorldXllTB","owner":"fafalone","description":"Making Excel XLL Addins in twinBASIC","archived":false,"fork":false,"pushed_at":"2026-01-22T02:12:51.000Z","size":67,"stargazers_count":8,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-22T15:56:28.811Z","etag":null,"topics":["excel","excel-addin","excel-xll","twinbasic","vb6","vba"],"latest_commit_sha":null,"homepage":"","language":"VBA","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fafalone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-06T03:42:10.000Z","updated_at":"2026-01-22T02:12:55.000Z","dependencies_parsed_at":"2025-09-02T00:35:12.601Z","dependency_job_id":"1d8c9cd1-3dd6-4048-ad4c-ba41fc660901","html_url":"https://github.com/fafalone/HelloWorldXllTB","commit_stats":null,"previous_names":["fafalone/helloworldxlltb"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fafalone/HelloWorldXllTB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FHelloWorldXllTB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FHelloWorldXllTB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FHelloWorldXllTB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FHelloWorldXllTB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fafalone","download_url":"https://codeload.github.com/fafalone/HelloWorldXllTB/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FHelloWorldXllTB/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29453413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["excel","excel-addin","excel-xll","twinbasic","vb6","vba"],"created_at":"2024-12-07T23:13:27.112Z","updated_at":"2026-02-14T19:32:03.489Z","avatar_url":"https://github.com/fafalone.png","language":"VBA","funding_links":[],"categories":[],"sub_categories":[],"readme":"### For a more useful intro to XLLs with tB, check out my followup to this project, creating User-Defined Functions: https://github.com/fafalone/TBXLLUDF\n\n# HelloWorldXllTB\nMaking Excel XLL Addins in twinBASIC\n\n![image](https://github.com/user-attachments/assets/f310f0bd-8884-44aa-9363-d10d34020b37)\n\nThis is a twinBASIC port of https://github.com/edparcell/HelloWorldXll, showing the basic concept of how to make an XLL addin using the same language VBA programmers are used to.\n\n### Using the project\nYou need only to compile, then in Excel, on the Developer tab click 'Excel Add-ins', then 'Browse', and navigate to wherever your .xll file is.\n\n### How it was made\n\nStep 1: Create a new Standard DLL project in twinBASIC.\n\nStep 2: Configure project settings (under the Project menu). You'll need to manually change the output path to have a `.xll` extension, since tB doesn't have a specific project type for this yet, but it's just a renamed DLL anyway. I'm not sure if it's *absolutely* needed, but since the XLCall32.dll we need won't be in the same folder as our xll or System32, I've done like C and put it in the IAT by changing the **Project: Runtime Binding of DLL Declares** to **No**. \n\nStep 3: Add definitions. As part of this project, I've gone ahead and created a tB version of the entire Excel SDK's xlcall.h, so you can reuse this section in other projects and have everything you need. There's also some standard Windows API defs below this for the demo; you don't need these if you use my WinDevLib package which defines all common APIs.\n\nStep 4: Add the `XLAutoOpen` function as a `[DllExport]` and its code:\n\n```\n    [DllExport]\n    Public Function xlAutoOpen() As Integer\n \n        Dim text As String = StrConv(\"Hello world from a twinBASIC XLL Addin!\", vbFromUnicode)\n        Dim text_len As Long = Len(\"Hello world from a twinBASIC XLL Addin!\")\n        Dim message As XLOPER\n        message.xltype = xltypeStr\n       \n        Dim pStr As LongPtr = GlobalAlloc(GPTR, text_len + 2) 'Excel frees it, that's why this trouble\n        CopyMemory ByVal VarPtr(message), pStr, LenB(pStr)\n        CopyMemory ByVal pStr, CByte(text_len), 1\n        CopyMemory ByVal pStr + 1, ByVal StrPtr(text), text_len + 1\n \n        Dim dialog_type As XLOPER\n        dialog_type.xltype = xltypeInt\n        Dim n As Integer = 2\n        CopyMemory ByVal VarPtr(dialog_type), n, 2\n \n        Excel4(xlcAlert, vbNullPtr, 2, ByVal VarPtr(message), ByVal VarPtr(dialog_type))\n        Return 1\n    End Function\n```\n\nIt's a little complicated here since we need an ANSI string that Excel can free without tB freeing it automatically as well, which would crash. So we do some memory allocation.\n\nThe biggest problem in code is the absolutely horrendous `XLOPER` type. It's got tons of unions of sub-types, neither of which tB currently supports. So I've calculated the correct size in bytes, and substituted `LongLong` because it needs to be aligned on an 8-byte boundary, even in 32bit because `Double` is a union option. No matter what the type, it's copied to offset 0, the very beginning. \n\nUnlike VBA, twinBASIC supports variadic functions, so we can use either `Excel4` or `Excel4v`. \n\nSo while this project does use some twinBASIC-only syntax, using what's essentially a newer version of VBA is still far, far better than needing to know C/C++!\n\n\u003e [!NOTE]\n\u003e So far I've only had time to test in 64bit Excel 2021.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffafalone%2Fhelloworldxlltb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffafalone%2Fhelloworldxlltb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffafalone%2Fhelloworldxlltb/lists"}