r/vba • • 1d ago

Weekly Recap This Week's /r/VBA Recap for the week of November 07 - November 13, 2026

4 Upvotes

Saturday, November 07 - Friday, November 13, 2026

Top 5 Posts

scorecommentstitle & link
5722 comments[Advertisement] WinVBA 1.0 has been released
1017 comments[Waiting on OP] Python vs Excel/VBA for an automated document generator used by non-technical staff?
109 comments[Show & Tell] RDCore v0.1.0-alpha is here
52 comments[Show & Tell] VBA-UserForm-Transpiler Excel VBA UserForm to other programming languages converter
41 comments[Weekly Recap] This Week's /r/VBA Recap for the week of October 31 - November 06, 2026

 

Top 5 Comments

scorecomment
10/u/Ok-Programmer9295 said Wow! Thank you. I’m retired now and not doing much coding anymore, but I wish I’d had this when I was working.
7/u/ebsf said This is well understood in the Access VBA community. Traditionally, a collection of UDTs could not be iterated, although a collection of class instances can. IUnknown is an interface all COM classes...
5/u/wickedja said I would go the route of vba userform within excel. They're a little dated but you can still customise them a bit, make them user proof and have them be dynamic (in your case only showing certain f...
5/u/still-dazed-confused said Forgive an extremely naive question as I'm not technical :). Does this price VBA code which lives inside the ms office file and is distributed inside it or does it produce separate executable prog...
5/u/Thadrea said I am honestly skeptical this will be useful to many people. The people using VBA as a workaround for automating work when IT restrictions prevent installing/using a more robust toolkit will not be ab...

 


r/vba • • 1d ago

Waiting on OP Highlight active row conditional formatting - stale rows

1 Upvotes

I've got an expense tracker with a highlight active row (light green fill) using '=ROW()=CELL("row")' on A2:E9999 +

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Me.Calculate

End Sub

On a sheet with only a few rows of data (e.g. rows 1–11), clicking in the blank rows underneath (12, 13, 14…) doesn't repaint properly:

  • the old row stays green after you move away, so 2–3 rows are highlighted at once

  • the new row is late to highlight, or only a 1-pixel sliver of it gets drawn

  • zooming in/out with the trackpad instantly repaints it correctly

Has anyone seen this, or know what Excel's repaint logic is actually doing here?


r/vba • • 2d ago

Waiting on OP Python vs Excel/VBA for an automated document generator used by non-technical staff?

14 Upvotes

Hello everyone

Let me give you a little context I am currently working in a french hospital, and I would like to develop a tool to automate the creation of administrative letters, if you don't know french public administrations are VERY VERY VERY outdated i am working here as a buying manager and as expected from a place like this we lack staff a lot because of budget cuts so i am most of the time doing administrative task like writing letters instead of studying prices and doing negotiations.

We regularly receive supplier quotations and need to generate different types of formal boring documents ( to be honest we could just sign the pricing proposal but the Head of Department is from the medical field have no training in administration and she is very old so she wants to keep it that way ) so we write letters for things such as price acceptance letters, price revision and adjustment letters, product reference changes, product substitutions, currently, much of this work is done manually using Word.

Right now I have a dropdown to choose which type of letter I want, some fields for the supplier, contract number, product references, prices, dates etc. I also added another sheet where I can select which hospitals are concerned, and a small supplier database.

But I' am not really happy with it.

For example, if I choose a letter about changing a product reference, I still see fields asking for old prices, new prices and other stuff that has nothing to do with that letter

What I would really like is for the form to change depending on which letter I select. So only the information I actually need would appear. And then once everything is filled in, I just click a button and it generates the Word letter using our existing templates. Being able to export it to PDF would be nice too.

Now here's where I'm a bit lost.

Should I keep working on Excel and use VBA to make it better? Or should I just start over with Python and make a proper little application?

I am not a developer btw, I'm just interested in this stuff and trying to learn as I go, so for those of you who have more experience with this kind of thing, what would you do?

Would you stick with Excel/VBA or go for Python? And if Python is better, how would you make something that people can use without having to install Python themselves?

One important detail this is a hospital environment, so computers have IT restrictions, and most users aren't particularly good with computers. my goal is to eventually present a reliable, easy to use solution to my Head of Department.

Also how complicated would it be to make different forms for each letter type without having to code everything separately?

Sorry if these are stupid questions I am still figuring things out haha.

Any advice or feedback would really help!

so i would love your advice on

  1. Is Excel/VBA sufficient for this kind of application?

  2. Would Python be a better long-term solution?

  3. What GUI framework would you recommend for non-technical Windows users?

  4. How would you handle different document types with their own required fields?

  5. How difficult would deployment and maintenance be in a restricted corporate environment?

  6. I'm still learning, so any feedback on the architecture, user experience, or technical approach would be greatly appreciated.

Thanks :))

( sorry for my english I am trying to not use ia )


r/vba • • 3d ago

Show & Tell RDCore v0.1.0-alpha is here

16 Upvotes

Blog: http://rubberduckvba.blog/2026/11/11/introducing-rdcore-rd-vba-language-platform-v0-1-0-alpha/

Rubberduck becomes VBA and introduces RD-VBA.

This is it, this is what the Rubberduck 3.0 pipe dream was, except it's an entire language platform, not just a VBE add-in: the platform itself ships a runtime, a host, a SDK, and a language server.

The host executable is also a CLI tool and REPL LSP client/editor that works essentially like BASIC did, but with ghost-text line edits, syntax highlighting and conditional breakpoints and error stack traces, block foldings, diagnostics and code actions, completion lists that understand PascalCase, signature help, an `Erl` function that actually works, application settings in .json files, air-gapped external and native calls, and much more: it's a demo of (almost) everything the platform can do, wrapped up in a fun, theme-enabled BASIC shell that runs everywhere .net does.


r/vba • • 5d ago

Advertisement WinVBA 1.0 has been released

60 Upvotes

WinVBA - an IDE for Visual Basic for Applications

Today we would like to announce the release of WinVBA 1.0.0, a modern IDE for Visual Basic for Applications (VBA) development.

![image](https://winvba.com/assets/img/shots/1.png)

Features

A list of features can be seen here:

https://winvba.com/features/

Some of the features:

Editor

  • Tabbed interface

  • Syntax highlighting

  • Code auto completion

Code navigation

  • View Sub/Functions in treeview

  • View variables in treeview

  • View references in treeview

Debugging

Source control (git)

  • You can easily export the project or individual modules to disk as text files or ZIP archive.

AI Integration

  • Connect the editor to ChatGPT, Grok, Claude, Mistral and use it to improve your code

Compatibility

  • The IDE supports: Word, Excel, PowerPoint, Access, Project, Visio

Download and Installation

To install this product simply download the latest version from https://winvba.com/download/

Extract the ZIP file to a folder of your choice.

  1. Copy the WinVBA.exe file to your Desktop.

  2. Install the Office Add-in by opening the WinVBA Add-in folder and running Setup.exe This will add 3 buttons in the Developer tab: WinVBA Code, Macros, Settings.

  3. Configure the path to the WinVBA.exe in the settings

  4. Open the WinVBA.exe file to start the application and select the Office file to open or open your workbook and select WinVBA from the Developer tab.

Feedback

Any feedback is highly appreciated. We will be working in continuously fixing bugs and improving the software. Leave feedback in the comments below or contact us directly.


r/vba • • 6d ago

Show & Tell Thumbnails LibRetro Downloader 3.0 - SeleniumVBA (Not SeleniumBasic)

0 Upvotes

Hello gamers, and welcome back to the channel! In my last video, we talked about migrating to SeleniumVBA. Today, we’re looking at the second tool in the lineup: Thumbnails LibRetro Downloader 3.0 - SeleniumVBA.xlsm. In this video, I’m going to show you how to streamline your migration by wrapping all that heavy lifting into a single, powerful, reusable subroutine called BrowseTo. With just one clean line of code, this smart function automatically manages the new SeleniumVBA syntax, recycles active browser instances, so you aren't constantly spinning up slow new windows, handles window states, patches URL space encodings, and traps launch errors gracefully before they crash your workbook. Let's dive into the code and unlock the true potential of SeleniumVBA.

https://youtu.be/x6qr5T2OvP0


r/vba • • 6d ago

Waiting on OP Custom ForEach Loop, how far can we go?

2 Upvotes

Hello There,

I just discovered the fact, that VBA classes can have their own custom For Each Iteration.

One example from my linked List Datastructure:

'Inside my LinkedList class
Public Property Get NewEnum() As IUnknown
    Attribute NewEnum.VB_UserMemId = -4

    Dim Items As New Collection
    Dim CurrentNode As std_Node

    Set CurrentNode = mFirstNode

    Do While Not CurrentNode Is Nothing
        Call Items.Add(CurrentNode.Value)
        Set CurrentNode = CurrentNode.FirstReference
    Loop

    Set mEnumeratorCollection = Items

    Set NewEnum = mEnumeratorCollection.[_NewEnum]
End Property




' In Module1
Public Sub TestLinked()
    Dim LL As std_LinkedList
    Set LL = std_LinkedList.CreateWithValue(1)
    Call LL.Push(2)
    Call LL.Push(3)
    Call LL.Push(4)
    Call LL.Push(5)
    
    Call LL.Remove(3)
    Call LL.Insert(2, 20)
    Call LL.Pop
    
    Dim Item As Variant
    For Each Item In LL
        Debug.Print Item * 2
    Next Item
End Sub

I would like to understand what I just did, why and how it works and why it was designed this way. What is IEnumVariant, IUnknown etc. that I need to make this work, is there another way to invoke it aside from using Collection, what about the lifetime, since right now im only able to make it work by adding the mEnumeratorCollection Variable inside the class instance? What have you guys already made with this class (Im aware of Sancarn´s stdEnumerator class, but im looking for other implementations and when it makes sense to even use this)


r/vba • • 7d ago

Show & Tell VBA-UserForm-Transpiler Excel VBA UserForm to other programming languages converter

8 Upvotes

Hey everyone!

I'd like to share a project I've been working on for over a year: VBA-UserForm-Transpiler.

The goal of this project is to make it possible to convert Excel VBA UserForms into other programming languages.

The idea came from a simple question: Why can't we take advantage of how easy it is to build GUIs with VBA UserForms in other languages?

For example, when working with Python's Tkinter, creating a GUI manually can be quite tedious. There's a tool called PAGE for Tkinter, but in my opinion, it doesn't offer quite the same level of convenience as VBA UserForms.

Even with generative AI, getting the GUI you have in mind just by describing it through text prompts isn't always easy.

On the other hand, VBA's UserForm designer lets you create exactly the GUI you want simply by using your mouse. It's incredibly intuitive and convenient.

VBA-UserForm-Transpiler was created to bring that convenience to other programming languages.

Currently, it supports transpiling VBA UserForms into:

・Python (Tkinter)

・PowerShell (WinForms)

・HTML

You can check out the project here:

https://github.com/ZeeZeX/VBA-UserForm-Transpiler

I'd love to hear your thoughts and feedback! Thanks for checking it out!


r/vba • • 8d ago

Weekly Recap This Week's /r/VBA Recap for the week of October 31 - November 06, 2026

4 Upvotes

Saturday, October 31 - Friday, November 06, 2026

Top 5 Posts

scorecommentstitle & link
150 comments[Show & Tell] [TOOL] USB DriveRescuer V1.0 – A professional VBA utility to restore lost .CHK files from FOUND.000 folders
131 comments[Show & Tell] A native VBA Regex engine: speed up and correctness.
126 comments[Show & Tell] [ACCESS] Metadata-driven Excel report compiler using SQL, VBA, and COM automation
40 comments[ProTip] Running cross platform VBA code: ASF — MS Office, LibreOffice
41 comments[Weekly Recap] This Week's /r/VBA Recap for the week of October 24 - October 30, 2026

 

Top 5 Comments

scorecomment
6/u/sancarn said /preview/pre/xcf2zmimuwyh1.png?width=956&format=png&auto=webp&s=4319f850a5df22ba2b7e81d9ee43e2294dbd0825 As an experiment, I've built a native variant using thunks... mental
3/u/rdcore-admin said Ohh nice!! See this is part of the things that make this new era of AI-assisted open-source so awesome! I made the repo read-only upstream to focus on RDCore (progressing very well!), but I'm...

 


r/vba • • 9d ago

Show & Tell SeleniumVBA - XPath Generator 2.0 (Excel) NOT SeleniumBasic

5 Upvotes

Hello gamers, and welcome back to the channel! In this video, I am migrating all my Excel tools from Selenium Basic over to Selenium VBA, starting with this tool right here: the Selenium VBA - XPath Generator 2.0.xlsm. Let’s be honest—the old legacy Selenium Basic hasn’t been updated since 2016, and it’s really starting to show its age. One of the biggest headaches with the old version was constantly having to download and replace web drivers manually, every single time your browser updated. But with this new Selenium VBA framework, those days are over. It handles driver updates automatically in the background, giving you vastly better browser handling, smoother execution, and a completely seamless automation experience.

https://youtu.be/y1z21jGsfGI


r/vba • • 10d ago

ProTip Running cross platform VBA code: ASF — MS Office, LibreOffice

4 Upvotes

Multi platform VBA code is a dream for many developers automating the office suite, maybe this ends now. With the release of the ASF v3.4.0, users can execute the same code in different host and across different office suites.

I think u/BrightNeedleworker30 will love it, with the ASF update VBA code feels modern and more powerful.

Here I'm giving to you a guide with six ASF scripts that run unchanged in the six office applications: Excel, Word and PowerPoint, and LibreOffice Calc, Writer and Impress. The same budget.vas writes a sheet in Excel or Calc, a document with headings and a table in Word or Writer, and slides in PowerPoint or Impress.

Until now no macro code ran in both suites: VBA does not run in LibreOffice, and LibreOffice Basic and its UNO API do not run in Microsoft Office. With ASF the logic is written once, in .vas files, and each suite only needs the engine and a host of a few lines.

Writing portable scripts

  • Talk to the document through lib/office.vas, not through Range, Paragraphs or UNO objects: those belong to one suite.

  • Read input with doc.input(name, fallback). A blank cell is '' in Calc and an empty value in Excel; isBlank of lib/table.vas takes both as blank.

  • Round with roundTo or round2 of lib/table.vas when the result must match to the cent: Math.round rounds half to even, as VBA does, while these round half away from zero. Format with show and dateText, which do not depend on the locale.

  • Put what several scripts share in a module and import it: the hosts set the scripts folder as the working directory, so ./lib/office.vas resolves in both suites.

  • A let inside a nested function assigns a variable of the same name in the enclosing function, as ASF functions share the scope they are written in: give inner variables their own names.

  • Keep scripts plain ASCII and write other characters as escapes (²), so that every host reads the files the same way.

How it works

host macro --(the open document as $1)--> script.vas --> lib/office.vas --> Excel | Word | PowerPoint | Calc | Writer | Impress
  • The host passes the open document to the script, nothing else. hosts/OfficeHost.bas is one VBA module for Excel, Word and PowerPoint; hosts/LibreOfficeHost.bas is one Basic module for Calc, Writer and Impress. Both have the macros RunHello, RunBudget, RunProgress, RunPriceRevision, RunWorkReports, RunCleanup and RunAll.

  • scripts/lib/office.vas is the only code that knows the applications. open($1) finds out which one holds the document and returns the same small API for the six:

In Microsoft Office it calls the VBA object model (Worksheets, Paragraphs, Slides); in LibreOffice the UNO API (getSheets, text cursors, draw pages). ASF reaches both from the same script.

  • scripts/lib/table.vas turns a table into one object per row, keyed by column name, rounds amounts and formats numbers and dates the same way everywhere.

  • To change a rule, edit the script; to support another kind of output, edit lib/office.vas. The hosts stay as they are.

The scripts need ASF 3.3.2 or later (the classes of src/, or ASF.oxt 3.3.2).

Here is the content of the office.vas ASF module (a full fledged automation API):

// One API for the whole office suite: Excel, Word and PowerPoint, and LibreOffice Calc, Writer
// and Impress. open(doc) looks at the document the host passes and returns
//
//   app, kind              'Excel' ... 'Impress'; 'spreadsheet', 'text' or 'presentation'
//   input(name, fallback)  in a spreadsheet, the table around A1 of sheet name; otherwise fallback
//   report(title, sub)     starts a report: a new sheet, a document heading or a title slide
//
// and a report has
//
//   section(text)          a bold row, a level 2 heading or a new slide
//   line(text)             a row, a paragraph or a bullet
//   table(rows)            cells, a document table or one bullet per row; numbers stay numbers in sheets
//   done()                 finishes the report and returns a line for the host to show
//
// Scripts that only use this API run unchanged in the six applications.
import { show } from './table.vas';

// Text of a table cell outside a spreadsheet
let cellText = fun(v) {
    return show(v);
};

// Rows padded to the same width, for ranges and tables; text turns every cell into text.
// (map and forEach would visit the cells: on an array of arrays they go down to the leaves)
let padded = fun(rows, text) {
    let w = 0;
    for (let i = 1, i <= rows.length, i += 1) {
        if (rows[i].length > w) { w = rows[i].length; };
    };
    let out = [];
    for (let i = 1, i <= rows.length, i += 1) {
        let r = rows[i];
        let line = [];
        for (let j = 1, j <= w, j += 1) {
            let v = '';
            if (j <= r.length) { v = r[j]; };
            if (text) { v = cellText(v); };
            line.push(v);
        };
        out.push(line);
    };
    return out;
};

// One line of text per row, for slides
let rowLines = fun(rows) {
    let out = [];
    let block = padded(rows, true);
    for (let i = 1, i <= block.length, i += 1) {
        out.push(block[i].join('   |   '));
    };
    return out;
};

// ---------------------------------------------------------------- Excel (VBA object model)
let excel = fun(wb) {
    let sheet = fun(name) {
        try {
            return wb.Worksheets(name);
        } catch (e) {
            return null;
        };
    };
    let report = fun(title, subtitle) {
        let ws = sheet(title);
        if (ws == null) {
            ws = wb.Worksheets.Add();
            ws.Name = title;
        } else {
            ws.Cells.ClearContents();
        };
        let row = 1;
        let put = fun(values, bold) {
            ws.Cells(row, 1).Resize(1, values.length).Value2 = [values];
            if (bold) { ws.Rows(row).Font.Bold = true; };
            row += 1;
        };
        put([title], true);
        put([subtitle], false);
        row += 1;
        return {
            section: fun(text) { put([text], true); },
            line: fun(text) { put([text], false); },
            table: fun(rows) {
                let block = padded(rows, false);
                ws.Cells(row, 1).Resize(block.length, block[1].length).Value2 = block;
                ws.Rows(row).Font.Bold = true;
                row += block.length + 1;
            },
            done: fun() {
                ws.Columns.AutoFit();
                return `${title}: sheet written in Excel`;
            }
        };
    };
    return {
        app: 'Excel', kind: 'spreadsheet', report: report,
        input: fun(name, fallback) {
            let ws = sheet(name);
            if (ws == null) { return fallback; };
            return ws.Range('A1').CurrentRegion.Value2;
        }
    };
};

// ---------------------------------------------------------------- Calc (UNO)
let calc = fun(doc) {
    let sheets = doc.getSheets();
    let report = fun(title, subtitle) {
        if (!sheets.hasByName(title)) {
            sheets.insertNewByName(title, sheets.getCount());
        };
        let sh = sheets.getByName(title);
        sh.clearContents(23);
        let row = 0;
        let put = fun(values, bold) {
            let r = sh.getCellRangeByPosition(0, row, values.length - 1, row);
            r.setDataArray([values]);
            if (bold) { r.CharWeight = 150; };
            row += 1;
        };
        put([title], true);
        put([subtitle], false);
        row += 1;
        return {
            section: fun(text) { put([text], true); },
            line: fun(text) { put([text], false); },
            table: fun(rows) {
                let block = padded(rows, false);
                sh.getCellRangeByPosition(0, row, block[1].length - 1, row + block.length - 1).setDataArray(block);
                sh.getCellRangeByPosition(0, row, block[1].length - 1, row).CharWeight = 150;
                row += block.length + 1;
            },
            done: fun() {
                sh.getColumns().OptimalWidth = true;
                return `${title}: sheet written in Calc`;
            }
        };
    };
    return {
        app: 'Calc', kind: 'spreadsheet', report: report,
        input: fun(name, fallback) {
            if (!sheets.hasByName(name)) { return fallback; };
            let sh = sheets.getByName(name);
            let cursor = sh.createCursorByRange(sh.getCellRangeByName('A1'));
            cursor.collapseToCurrentRegion();
            return cursor.getDataArray();
        }
    };
};

// ---------------------------------------------------------------- Word (VBA object model)
let word = fun(d) {
    // wdStyleHeading1, wdStyleHeading2, wdStyleNormal
    let add = fun(text, style) {
        d.Content.InsertAfter(text);
        d.Content.InsertParagraphAfter();
        d.Paragraphs(d.Paragraphs.Count - 1).Style = style;
    };
    let report = fun(title, subtitle) {
        add(title, -2);
        add(subtitle, -1);
        return {
            section: fun(text) { add(text, -3); },
            line: fun(text) { add(text, -1); },
            table: fun(rows) {
                let block = padded(rows, true);
                let t = d.Tables.Add(d.Paragraphs(d.Paragraphs.Count).Range, block.length, block[1].length);
                t.Borders.Enable = true;
                for (let i = 1, i <= block.length, i += 1) {
                    for (let j = 1, j <= block[i].length, j += 1) {
                        t.Cell(i, j).Range.Text = block[i][j];
                    };
                };
                t.Rows(1).Range.Font.Bold = true;
            },
            done: fun() { return `${title}: document written in Word`; }
        };
    };
    return { app: 'Word', kind: 'text', report: report, input: fun(name, fallback) { return fallback; } };
};

// ---------------------------------------------------------------- Writer (UNO)
let writer = fun(d) {
    let text = d.getText();
    let cursor = text.createTextCursor();
    let add = fun(s, style) {
        cursor.gotoEnd(false);
        text.insertString(cursor, s, false);
        cursor.ParaStyleName = style;
        text.insertControlCharacter(cursor, 0, false);
    };
    let report = fun(title, subtitle) {
        add(title, 'Heading 1');
        add(subtitle, 'Standard');
        return {
            section: fun(s) { add(s, 'Heading 2'); },
            line: fun(s) { add(s, 'Standard'); },
            table: fun(rows) {
                let block = padded(rows, true);
                let t = d.createInstance('com.sun.star.text.TextTable');
                t.initialize(block.length, block[1].length);
                cursor.gotoEnd(false);
                text.insertTextContent(cursor, t, false);
                t.setDataArray(block);
            },
            done: fun() { return `${title}: document written in Writer`; }
        };
    };
    return { app: 'Writer', kind: 'text', report: report, input: fun(name, fallback) { return fallback; } };
};

// ---------------------------------------------------------------- PowerPoint (VBA object model)
let powerpoint = fun(p) {
    // ppLayoutTitle, ppLayoutText
    let addSlide = fun(layout, title) {
        let s = p.Slides.Add(p.Slides.Count + 1, layout);
        s.Shapes(1).TextFrame.TextRange.Text = title;
        return s;
    };
    let report = fun(title, subtitle) {
        addSlide(1, title).Shapes(2).TextFrame.TextRange.Text = subtitle;
        let body = null;
        let lines = [];
        let bullet = fun(s) {
            if (body == null) {
                body = addSlide(2, title).Shapes(2).TextFrame.TextRange;
                lines = [];
            };
            lines.push(s);
            body.Text = lines.join('\r');
        };
        return {
            section: fun(s) { body = addSlide(2, s).Shapes(2).TextFrame.TextRange; lines = []; },
            line: bullet,
            table: fun(rows) {
                // not lines: a let in a nested function assigns the variable of the enclosing one
                let text = rowLines(rows);
                for (let i = 1, i <= text.length, i += 1) { bullet(text[i]); };
            },
            done: fun() { return `${title}: slides written in PowerPoint`; }
        };
    };
    return { app: 'PowerPoint', kind: 'presentation', report: report, input: fun(name, fallback) { return fallback; } };
};

// ---------------------------------------------------------------- Impress (UNO)
let impress = fun(d) {
    let pages = d.getDrawPages();
    let used = false;
    // a new presentation has one slide with empty placeholders
    let blank = fun(pg) {
        for (let k = 0, k < pg.getCount(), k += 1) {
            if (pg.getByIndex(k).getString() != '') { return false; };
        };
        return true;
    };
    // AutoLayout: 0 title slide, 1 title and content
    let addSlide = fun(layout, title) {
        let pg = null;
        if (!used && pages.getCount() == 1 && blank(pages.getByIndex(0))) {
            pg = pages.getByIndex(0);
        } else {
            pg = pages.insertNewByIndex(pages.getCount() - 1);
            pg = pages.getByIndex(pages.getCount() - 1);
        };
        used = true;
        pg.Layout = layout;
        pg.getByIndex(0).setString(title);
        return pg;
    };
    let report = fun(title, subtitle) {
        addSlide(0, title).getByIndex(1).setString(subtitle);
        let body = null;
        let lines = [];
        let bullet = fun(s) {
            if (body == null) {
                body = addSlide(1, title).getByIndex(1);
                lines = [];
            };
            lines.push(s);
            body.setString(lines.join('\n'));
        };
        return {
            section: fun(s) { body = addSlide(1, s).getByIndex(1); lines = []; },
            line: bullet,
            table: fun(rows) {
                // not lines: a let in a nested function assigns the variable of the enclosing one
                let text = rowLines(rows);
                for (let i = 1, i <= text.length, i += 1) { bullet(text[i]); };
            },
            done: fun() { return `${title}: slides written in Impress`; }
        };
    };
    return { app: 'Impress', kind: 'presentation', report: report, input: fun(name, fallback) { return fallback; } };
};

// ---------------------------------------------------------------- the document the host passed
fun open(doc) {
    let t = typeof doc;
    if (t == 'object: <Workbook>') { return excel(doc); };
    if (t == 'object: <Document>') { return word(doc); };
    if (t == 'object: <Presentation>') { return powerpoint(doc); };
    if (doc.supportsService('com.sun.star.sheet.SpreadsheetDocument')) { return calc(doc); };
    if (doc.supportsService('com.sun.star.text.TextDocument')) { return writer(doc); };
    if (doc.supportsService('com.sun.star.presentation.PresentationDocument')) { return impress(doc); };
    throw `not an office document: ${t}`;
};

export { open };

r/vba • • 10d ago

Show & Tell [TOOL] USB DriveRescuer V1.0 – A professional VBA utility to restore lost .CHK files from FOUND.000 folders

14 Upvotes

Hi everyone,

I wanted to share a professional VBA tool I’ve built called USB DriveRescuer V1.0.

It’s designed to tackle a classic data recovery issue: dealing with corrupted USB drives where chkdsk has dumped everything into a hidden FOUND.000 folder as generic .chk files.

Instead of manually renaming them, USB DriveRescuer scans the drive, automates the recovery, and checks the file signatures (Hex/Magic Bytes) to accurately convert them back to their original file extensions (like PDF, JPG, DOCX, etc.).

⚙️ Core Features:

• Automated Scanning: Instantly targets FOUND.000 directories on selected USB drives.

• Signature-Based Identification: Analyzes the actual file headers on a byte level rather than just guessing.

• Batch Conversion: Restores thousands of .chk files back to fully working original formats with one click.

• User-Friendly UI: Built entirely within a clean, custom VBA UserForm with real-time progress tracking.

🛠️ Why VBA?

I wanted to prove that VBA can be highly professional and capable of handling low-level file heuristic tasks when combined with the right Windows API calls and byte-stream logic.

I’ve just hosted the project over on itch.io!

I would love to hear your feedback on the architecture, or any specific file signatures you think I should add to the recognition engine!

Option Explicit

#If VBA7 Then
    Private Declare PtrSafe Function SafeArrayGetDim Lib "oleaut32.dll" (ByRef saArray() As Any) As Long
#Else
    Private Declare Function SafeArrayGetDim Lib "oleaut32.dll" (ByRef saArray() As Any) As Long
#End If
' Globale Variablen für die Sortierrichtung (True = Aufsteigend, False = Absteigend)
Dim sortAscName As Boolean
Dim sortAscSize As Boolean
Dim sortAscType As Boolean
Dim sortAscStatus As Boolean

' Funktion wandelt ein Byte-Array in einen Hex-String um
Private Function BytesToHex(bytes() As Byte) As String
    Dim i As Long
    Dim hexStr As String
    
    ' Prüfen, ob das Array überhaupt Dimensionen besitzt (0 = leer/uninitialisiert)
    If SafeArrayGetDim(bytes) = 0 Then
        BytesToHex = ""
        Exit Function
End If
    
    ' Zusätzlicher Schutz: Falls dimensioniert, aber leer (z.B. 0 Bytes groß)
    If UBound(bytes) < LBound(bytes) Then
        BytesToHex = ""
        Exit Function
    End If
    
    hexStr = ""
    For i = LBound(bytes) To UBound(bytes)
        If bytes(i) < 16 Then
            hexStr = hexStr & "0" & Hex(bytes(i))
        Else
            hexStr = hexStr & Hex(bytes(i))
        End If
    Next i
    BytesToHex = hexStr
End Function

r/vba • • 14d ago

Show & Tell [ACCESS] Metadata-driven Excel report compiler using SQL, VBA, and COM automation

12 Upvotes

I’ve published a working reference implementation of a reporting architecture I originally began developing in 2009 and shelved for a number of years.

This is not primarily a charting demonstration or a formatted recordset export. Access SQL prepares the report data and grouping order, sorting tables describe variable-length report bands, VBA calculates their physical Excel coordinates, and metadata defines formulas, formatting, headers, subtotals, footers, grand totals, helper columns, and charts.

Excel is the required standalone business deliverable, while Access serves as the SQL, metadata, and orchestration layer.

The repository includes Medicare and KPI demonstration databases, generated workbooks, exported VBA source, screenshots, a Quick Start, worked SQL pipelines, and an architectural white paper.

GitHub project:

Metadata-Driven Excel Reporting Engine

I’m sharing this as a Show & Tell project and would be interested in observations from developers who have built recurring, customer-facing Excel workbooks from database applications.


r/vba • • 15d ago

Show & Tell A native VBA Regex engine: speed up and correctness.

14 Upvotes

A long time ago, I posted here a regular expression engine written entirely in VBA that is part of the Advanced Scripting Framework (ASF) library. As the ASF moves toward free and open-source software (FOSS) by being ported to LO BASIC —which makes it available in an open-source office suite— user u/sancarn has just pointed out some issues to me:

  • Lack of word boundaries

  • Lack of backreferences

Added to this is a suggestion from u/sslinky84:

Have you run any speed tests?

At the time of publication, performance wasn’t a concern because the ASF’s design philosophy focuses not on raw speed, but on a broad set of features.

But while planning the port, I realized that speed is indeed a concern when running LO BASIC code in VBA compatibility mode.

So I finished the work on ASF and optimized the regular expression engine.

Then I just run the test provided by u/sancarn and here I discuss the results.

ASF against Sihlfall: Test: 4.0× on average (0.8–177.8×, best on no-match scan); MatchAll: 59.2× on average (29.2–166.4×, best on literal scan); Replace: 3.1× on average (0.6–80.2×, best on literal scan); Compile + first Test: 0.3× on average (0.1–5.2×, best on literal scan). Geometric means over the workloads where both give the expected output.

ASF against Old stdRegex: Test: 0.4× on average (0.3–0.8×, best on no-match scan); MatchAll: 26.1× on average (0.5–67.9×, best on capture extraction); Replace: 0.1× on average (0.0–0.3×, best on no-match scan); Compile + first Test: 0.2× on average (0.1–0.5×, best on no-match scan). Geometric means over the workloads where both give the expected output.

Here is the raw data:

Test

Reused regex; first-match Boolean checked against the expected result.

WorkloadOld stdRegex (ms)Sihlfall (ms)ASF 290ad3e (ms)ASF v3.2.0 (ms)ASF (ms)
Literal scan0.00982.19858.3010.1440.017
Short validation0.00830.0320.3240.2450.023
Capture extraction0.00790.0300.4420.2350.023
Alternation and ignore case0.0110.0370.6200.3700.028
Multiline anchors0.00820.0360.5400.3400.028
No-match scan0.00942.12152.0770.0190.012
Word boundaries0.00710.021Not equivalent0.1130.016
Backreference0.00780.017Not equivalent0.1360.022

MatchAll

All matches and numbered captures checked. stdRegex returns dictionaries; ASF returns collections, so the output costs differ.

WorkloadOld stdRegex (ms)Sihlfall (ms)ASF 290ad3e (ms)ASF v3.2.0 (ms)ASF (ms)
Literal scan1.2025.870100.4540.1610.035
Short validation1.1971.2380.3190.2500.038
Capture extraction115.064117.80465.19224.3641.695
Alternation and ignore case114.740116.559107.77234.4042.045
Multiline anchors111.699118.88949.34933.5232.056
No-match scan0.0152.07450.6140.0270.028
Word boundaries2.3022.257Not equivalent0.2440.041
Backreference1.3341.204Not equivalent0.2000.041

Replace

Reused regex; global replacement. The complete output string, including capture substitutions, was checked.

WorkloadOld stdRegex (ms)Sihlfall (ms)ASF 290ad3e (ms)ASF v3.2.0 (ms)ASF (ms)
Literal scan0.0154.946116.3240.2080.062
Short validation0.0120.0470.3200.2680.055
Capture extraction0.0463.94461.94324.6212.524
Alternation and ignore case0.0674.924106.99138.8432.281
Multiline anchors0.0523.36762.12131.3253.013
No-match scan0.0122.15650.5450.0430.041
Word boundaries0.0110.075Not equivalent0.2960.069
Backreference0.0160.045Not equivalent0.2460.075

Compile + first Test

Fresh object, initialization and first Test together after global warm-up; constructor caches are bypassed.

WorkloadOld stdRegex (ms)Sihlfall (ms)ASF 290ad3e (ms)ASF v3.2.0 (ms)ASF (ms)
Literal scan0.1882.44859.2870.5810.471
Short validation0.2110.1101.4601.3321.290
Capture extraction0.1830.1132.1431.5621.407
Alternation and ignore case0.2340.1723.6251.4631.338
Multiline anchors0.1930.1242.1911.6471.542
No-match scan0.2132.22047.2190.3900.448
Word boundaries0.1920.083Not equivalent0.4740.436
Backreference0.1930.090Not equivalent0.5980.574

Also I ran tests against the corpus shared in the Sihlfall repository, that ensures anyone can perform the test and independently check the engine.

I want to hear from you, any change worthy for ASF?


r/vba • • 15d ago

Weekly Recap This Week's /r/VBA Recap for the week of October 24 - October 30, 2026

5 Upvotes

r/vba • • 16d ago

Show & Tell RetroBat External Storage Linker (Symbolic link - Junction)

0 Upvotes

Hello gamers, and welcome back to the channel! The RetroBat External Storage Linker is a VBA-powered Excel tool, designed to automatically generate a batch script that links heavy ROMs (PS3) & PSN games on your high capacity external storage, right back to your RetroBat installation on the C drive. Unlike error prone text editing workarounds, this script leverages Windows Directory Junctions, It allows you to keep your main RetroBat setup on your boot drive, while hosting your massive game library externally. RetroBat and its emulators continue to function normally, completely unaware that the files are actually living on another drive. Now that you know what the tool does, let's get started.

https://youtu.be/wneoTYLRmmM


r/vba • • 17d ago

Show & Tell Jam for All BASIC Dialects

5 Upvotes

I saw this on one of the Discord servers, and thought I would rebroadcast in case of interest:

https://itch.io/jam/jam-for-all-basic-dialects-8

While VBA doesn't get a mention, it does say "But you can use any other BASIC dialects which are not on the following list for this game jam", so it would be good if there was some VBA representation (wink wink, nudge nudge)...


r/vba • • 19d ago

Solved Word VBA - Trying to split a mail merged document into the individual files, retaining header and footers.

6 Upvotes

I get stuck at the bolded line below. It won't save. Please help!

Sub SplitDocKeepHeadersNumbered()

Dim SourceDoc As Document, TargetDoc As Document

Dim SgnSection As Section

Dim Path As String, BaseName As String

Dim i As Long

   

Set SourceDoc = ActiveDocument

Path = SourceDoc.Path & "\"

BaseName = "Split_Document_" ' Change this to your preferred filename base

   

' Loop through every section in your document

For i = 1 To SourceDoc.Sections.Count

Set SgnSection = SourceDoc.Sections(i)

' Create a new blank document

Set TargetDoc = Documents.Add

' Copy content from the section (excluding the section break itself)

Dim RangeToCopy As Range

Set RangeToCopy = SgnSection.Range

If i < SourceDoc.Sections.Count Then

RangeToCopy.End = RangeToCopy.End - 1

End If

' Paste formatted text into the new document

TargetDoc.Range.FormattedText = RangeToCopy.FormattedText

' Copy and replicate the primary Header

SgnSection.Headers(wdHeaderFooterPrimary).Range.Copy

TargetDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Paste

' Copy and replicate the primary Footer

SgnSection.Footers(wdHeaderFooterPrimary).Range.Copy

TargetDoc.Sections(1).Footers(wdHeaderFooterPrimary).Range.Paste

' Clear clipboard selection to avoid prompts

TargetDoc.Range.Collapse wdCollapseEnd

' Save document in numbered ascending order

TargetDoc.SaveAs2 FileName:=Path & BaseName & i & ".docx", FileFormat:=wdFormatXMLDocument

TargetDoc.Close SaveChanges:=wdDoNotSaveChanges

Next i

   

MsgBox "Successfully split into " & SourceDoc.Sections.Count & " individual files!", vbInformation, "Done"

End Sub


r/vba • • 20d ago

Show & Tell Rubberduck fork

4 Upvotes

I asked Claudia to work on a fork of Rubberduck to solve 8 years of pet peeves I had with it.

Ability to select multiple folders and files and delete them in bulk.

Ability to sync the code inside a xlsm to a folder structure, with 2-way sync.
also fixing the wrong line endings!!

On another note, Claudia went over all the code I have been writing and gave me such a long list of mistakes it humbled me very bad.


r/vba • • 22d ago

Weekly Recap This Week's /r/VBA Recap for the week of October 17 - October 23, 2026

2 Upvotes

Saturday, October 17 - Friday, October 23, 2026

Top 5 Posts

scorecommentstitle & link
913 comments[Show & Tell] Bringing back the capabilities of the Internet Explorer era to the present day.
79 comments[ProTip] Shift + Double Click on form module opens it in code view?
79 comments[Waiting on OP] Looking to automate Visio organizational charts for 800 employees using VBA and Excel
629 comments[Unsolved] How to Automate Converting PDF to excel by VBA
65 comments[Unsolved] [EXCEL] Check date across multiple lists, create an array with results, display array from the bottom upward?

 

Top 5 Comments

scorecomment
29/u/BaitmasterG said 1 - turn off calculations 2 - see a psychiatrist
14/u/talltime said LOL. What on Earth are you trying to accomplish
13/u/lolcrunchy said AI;DR
9/u/GreatValueBradPitt said I give it a B- for ragebait. This is ragebait, right?
9/u/Ok-Programmer9295 said Yes. Bring in all the data. I had the delusion that corporate data would be error free. LOL. The company didn’t validate the data at input so it was GIGO (Garbage In, Garbage Out).

 


r/vba • • 24d ago

Discussion [Tip/Snippet] A clean, base-agnostic function to extract the n-th digit or byte of any integer

7 Upvotes

Hi everyone,

While working on color extraction routines in VBA (deconstructing Long RGB numbers into Red, Green, and Blue bytes), I wanted a clean, generic way to extract positional values across any base (Base 10, Base 16, Base 256, etc.).

I ended up writing this utility function, which I call sfDigit😂

' Returns the n-th digit/byte from right to left (1-based) in a given Base.

Function sfDigit&(ByVal Number&, ByVal Position As Byte, Optional ByVal Base& = 10)

sfDigit = Int((Number Mod (Base ^ Position)) / (Base ^ (Position - 1)))

End Function

How it works

The core math relies on three steps:

Number Mod (Base ^ Position): Strips away all higher-magnitude digits to the left.

/ (Base ^ (Position - 1)): Shifts the target digit down to the units place.

Int(...): Encloses the division to lop off lower-magnitude trailing decimals cleanly without floating-point precision issues.

Practical Examples

1. Extracting Base-10 Digits

Dim num As Long

num = 98765

Debug.Print sfDigit(num, 1) ' Returns 5 (Units)

Debug.Print sfDigit(num, 3) ' Returns 7 (Hundreds)

2. RGB Color Extraction in VBA (Base 256)

Since Windows RGB colors are stored as 24-bit integers Red + Green * 256 + Blue * 65536, each color component is simply a digit in Base 256:

Dim c As Long

c = RGB(241, 254, 132)

' Position 1 = Red, Position 2 = Green, Position 3 = Blue

Debug.Print "R=" & sfDigit(c, 1, 256) ' 241

Debug.Print "G=" & sfDigit(c, 2, 256) ' 254

Debug.Print "B=" & sfDigit(c, 3, 256) ' 132

Why use this over bitmasks?

VBA lacks native bitwise shift operators (>> or <<). While traditional bitmasks (\ 256 Mod 256) work great for bytes, having a unified mathematical function makes positional extraction across arbitrary bases very intuitive.

Hope this helps anyone working on base conversion, custom encoding, or color parsing routines! Feedback and optimizations are always welcome.


r/vba • • 24d ago

ProTip Shift + Double Click on form module opens it in code view?

12 Upvotes

Maybe this is known but I sure didnt know about it. I hated always right clicking a form to get to View Code and I could have just held shift.

Just found out about this today.


r/vba • • 25d ago

Unsolved How to Automate Converting PDF to excel by VBA

13 Upvotes

Good morning I want to do the following

I want to use VBA to open PDF in adobe acrobat and convert it to excel all in.back ground using a button such that only one click will automate all of this how can I do this?

Some devices have that paid version of adobe acrobat

The excel file name can be the same as the pdf file name

And if there is a better alternative method do the same end results please share with me

Thank you


r/vba • • 25d ago

Waiting on OP Looking to automate Visio organizational charts for 800 employees using VBA and Excel

11 Upvotes

Hoping to get a little bit of advice from an expert or someone who’s pretty good with Visio and VBA. I’m looking for advice on automating organizational charts in Microsoft Visio using VBA and Excel for an organization of approximately 800 employees.

I’m currently responsible for maintaining our organization’s Visio org charts, which outline the reporting structure for around 800 employees. Updating these charts manually is a tedious and time-consuming process, especially since changes to employees, positions, supervisors, and departments happen fairly regularly.
I’d like to find a way to automate as much of this process as possible to save time and reduce the amount of manual work involved.

One of the main challenges is that the existing org charts have a specific layout and appearance that needs to be preserved. I’ve looked into Visio’s built-in organizational chart tools, but they don’t seem to provide the flexibility I need to reproduce our current charts exactly.

Fortunately, I have access to a fairly comprehensive Excel spreadsheet containing employee information, including employee IDs, position numbers, names, job titles, supervisors, and other relevant details. The data is relatively well organized, so I think it should be possible to use it as the foundation for an automated solution.

I’m considering using VBA to pull information from Excel and generate or update the corresponding shapes, text, and connectors in Visio. Ideally, I’d like the process to handle personnel changes without requiring me to manually redraw or rearrange the charts every time something changes.
I’m interested in hearing from anyone who has experience with Visio VBA automation or has tackled a similar project. Are there built-in features I’ve overlooked, or would a custom VBA solution be the best approach? I’d also appreciate any general algorithmic ideas or tips for keeping the charts organized while preserving their existing formatting.

Thanks in advance for any suggestions! Happy to provide answer any questions about the structure. Just looking for advice on how to best tackle this project.