r/vba • u/0x80070002 • 1d ago
Discussion Do you use Python instead of VBA?
I have not understood exactly the difference between xlite and pyXLL but I am wondering if someone uses Python to code and why?
r/vba • u/subredditsummarybot • 5d ago
Saturday, November 07 - Friday, November 13, 2026
| score | comments | title & link |
|---|---|---|
| 57 | 22 comments | [Advertisement] WinVBA 1.0 has been released |
| 10 | 17 comments | [Waiting on OP] Python vs Excel/VBA for an automated document generator used by non-technical staff? |
| 10 | 9 comments | [Show & Tell] RDCore v0.1.0-alpha is here |
| 5 | 2 comments | [Show & Tell] VBA-UserForm-Transpiler Excel VBA UserForm to other programming languages converter |
| 4 | 1 comments | [Weekly Recap] This Week's /r/VBA Recap for the week of October 31 - November 06, 2026 |
r/vba • u/0x80070002 • 1d ago
I have not understood exactly the difference between xlite and pyXLL but I am wondering if someone uses Python to code and why?
r/vba • u/SignalFirefighter323 • 1d ago
pyVBA-Interpreter is a VBA interpreter written with Python and parsed with ANTLR.
https://github.com/Beakerboy/PyVBA-Interpreter/tree/dev
A new contributor has just helped add array capabilities to the project. If you have ever wondered if you can run VBA code outside of Excel, or from a command line, this project allows you to do that.
If you want to test it, ask any questions here or on the GitHub project discussion page.
r/vba • u/Big_Exercise_8999 • 1d ago
Hey everyone!
I'm the developer behind a Google Workspace add-on designed to make migrating from Microsoft Excel to Google Sheets easier.
It helps users transfer and convert Excel VBA macros into Google Apps Script, making it easier to move existing spreadsheet automation from Excel to Google Sheets without having to rebuild everything from scratch.
I'm looking for a few beta testers who regularly work with Excel macros or Google Sheets and would be willing to try it out.
If you're interested, drop a comment or send me a DM. I'd really appreciate your help!
Thanks!
r/vba • u/Available-Peach-7013 • 2d ago
The previewer in file explorer only shows a blank preview for macro-enabled Excel files, no warning message, just blank. I installed the latest Windows update where you can click on "Show preview anyway", but this only works for pdfs, not for macro-enabled Excel files. Does anyone know a solution for this?
r/vba • u/aloilisia • 2d ago
Essentially, I want to loop the following code:
If Worksheets("Tabelle1").Range("A11") <> Worksheets("Tabelle1").Range("A10") Then
With Worksheets("Tabelle1").Range("A11:G11").Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = 0
End With
End If
If Worksheets("Tabelle1").Range("A12") <> Worksheets("Tabelle1").Range("A11") Then
With Worksheets("Tabelle1").Range("A12:G12").Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = 0
End With
End If
[...]
If Worksheets("Tabelle1").Range("A64") <> Worksheets("Tabelle1").Range("A63") Then
With Worksheets("Tabelle1").Range("A64:G64").Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = 0
End With
End If
End Sub
This is what I'm currently working with, which is obviously just not very elegant and efficient. I'm assuming there is a way to loop through this, but I'm not proficient enough with VBA to figure it out myself. Can anyone give me some advice?
Thank you in advance.
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
Thanks :))
( sorry for my english I am trying to not use ia )
r/vba • u/JoelSweet_ • 5d ago
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:
Has anyone seen this, or know what Excel's repaint logic is actually doing here?
r/vba • u/rdcore-admin • 6d ago
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.
Today we would like to announce the release of WinVBA 1.0.0, a modern IDE for Visual Basic for Applications (VBA) development.

A list of features can be seen here:
Some of the features:
Editor
Code navigation
Debugging
Source control (git)
AI Integration
Compatibility
To install this product simply download the latest version from https://winvba.com/download/
Extract the ZIP file to a folder of your choice.
WinVBA.exe file to your Desktop.WinVBA Add-in folder and running Setup.exe This will add 3 buttons in the Developer tab: WinVBA Code, Macros, Settings.WinVBA.exe in the settingsWinVBA.exe file to start the application and select the Office file to open or open your workbook and select WinVBA from the Developer tab.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 • u/Former_Ad_5957 • 10d ago
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.
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 • u/ZeeZeXZX • 11d ago
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 • u/subredditsummarybot • 12d ago
Saturday, October 31 - Friday, November 06, 2026
| score | comments | title & link |
|---|---|---|
| 15 | 0 comments | [Show & Tell] [TOOL] USB DriveRescuer V1.0 – A professional VBA utility to restore lost .CHK files from FOUND.000 folders |
| 13 | 1 comments | [Show & Tell] A native VBA Regex engine: speed up and correctness. |
| 12 | 6 comments | [Show & Tell] [ACCESS] Metadata-driven Excel report compiler using SQL, VBA, and COM automation |
| 4 | 0 comments | [ProTip] Running cross platform VBA code: ASF — MS Office, LibreOffice |
| 4 | 1 comments | [Weekly Recap] This Week's /r/VBA Recap for the week of October 24 - October 30, 2026 |
r/vba • u/Former_Ad_5957 • 13d ago
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.
r/vba • u/cookie_soft_57 • 14d ago
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 Functionr/vba • u/ws-garcia • 14d ago
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.
lib/office.vas, not through Range, Paragraphs or UNO objects: those belong to one suite.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.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.import it: the hosts set the scripts folder as the working directory, so ./lib/office.vas resolves in both suites.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.²), so that every host reads the files the same way.host macro --(the open document as $1)--> script.vas --> lib/office.vas --> Excel | Word | PowerPoint | Calc | Writer | Impresshosts/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.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 • u/Prize_Painter2546 • 18d ago
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 • u/ws-garcia • 18d ago
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:
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:
Reused regex; first-match Boolean checked against the expected result.
| Workload | Old stdRegex (ms) | Sihlfall (ms) | ASF 290ad3e (ms) | ASF v3.2.0 (ms) | ASF (ms) |
|---|---|---|---|---|---|
| Literal scan | 0.0098 | 2.198 | 58.301 | 0.144 | 0.017 |
| Short validation | 0.0083 | 0.032 | 0.324 | 0.245 | 0.023 |
| Capture extraction | 0.0079 | 0.030 | 0.442 | 0.235 | 0.023 |
| Alternation and ignore case | 0.011 | 0.037 | 0.620 | 0.370 | 0.028 |
| Multiline anchors | 0.0082 | 0.036 | 0.540 | 0.340 | 0.028 |
| No-match scan | 0.0094 | 2.121 | 52.077 | 0.019 | 0.012 |
| Word boundaries | 0.0071 | 0.021 | Not equivalent | 0.113 | 0.016 |
| Backreference | 0.0078 | 0.017 | Not equivalent | 0.136 | 0.022 |
All matches and numbered captures checked. stdRegex returns dictionaries; ASF returns collections, so the output costs differ.
| Workload | Old stdRegex (ms) | Sihlfall (ms) | ASF 290ad3e (ms) | ASF v3.2.0 (ms) | ASF (ms) |
|---|---|---|---|---|---|
| Literal scan | 1.202 | 5.870 | 100.454 | 0.161 | 0.035 |
| Short validation | 1.197 | 1.238 | 0.319 | 0.250 | 0.038 |
| Capture extraction | 115.064 | 117.804 | 65.192 | 24.364 | 1.695 |
| Alternation and ignore case | 114.740 | 116.559 | 107.772 | 34.404 | 2.045 |
| Multiline anchors | 111.699 | 118.889 | 49.349 | 33.523 | 2.056 |
| No-match scan | 0.015 | 2.074 | 50.614 | 0.027 | 0.028 |
| Word boundaries | 2.302 | 2.257 | Not equivalent | 0.244 | 0.041 |
| Backreference | 1.334 | 1.204 | Not equivalent | 0.200 | 0.041 |
Reused regex; global replacement. The complete output string, including capture substitutions, was checked.
| Workload | Old stdRegex (ms) | Sihlfall (ms) | ASF 290ad3e (ms) | ASF v3.2.0 (ms) | ASF (ms) |
|---|---|---|---|---|---|
| Literal scan | 0.015 | 4.946 | 116.324 | 0.208 | 0.062 |
| Short validation | 0.012 | 0.047 | 0.320 | 0.268 | 0.055 |
| Capture extraction | 0.046 | 3.944 | 61.943 | 24.621 | 2.524 |
| Alternation and ignore case | 0.067 | 4.924 | 106.991 | 38.843 | 2.281 |
| Multiline anchors | 0.052 | 3.367 | 62.121 | 31.325 | 3.013 |
| No-match scan | 0.012 | 2.156 | 50.545 | 0.043 | 0.041 |
| Word boundaries | 0.011 | 0.075 | Not equivalent | 0.296 | 0.069 |
| Backreference | 0.016 | 0.045 | Not equivalent | 0.246 | 0.075 |
Fresh object, initialization and first Test together after global warm-up; constructor caches are bypassed.
| Workload | Old stdRegex (ms) | Sihlfall (ms) | ASF 290ad3e (ms) | ASF v3.2.0 (ms) | ASF (ms) |
|---|---|---|---|---|---|
| Literal scan | 0.188 | 2.448 | 59.287 | 0.581 | 0.471 |
| Short validation | 0.211 | 0.110 | 1.460 | 1.332 | 1.290 |
| Capture extraction | 0.183 | 0.113 | 2.143 | 1.562 | 1.407 |
| Alternation and ignore case | 0.234 | 0.172 | 3.625 | 1.463 | 1.338 |
| Multiline anchors | 0.193 | 0.124 | 2.191 | 1.647 | 1.542 |
| No-match scan | 0.213 | 2.220 | 47.219 | 0.390 | 0.448 |
| Word boundaries | 0.192 | 0.083 | Not equivalent | 0.474 | 0.436 |
| Backreference | 0.193 | 0.090 | Not equivalent | 0.598 | 0.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 • u/subredditsummarybot • 19d ago
Saturday, October 24 - Friday, October 30, 2026
| score | comments | title & link |
|---|---|---|
| 7 | 7 comments | [Solved] Word VBA - Trying to split a mail merged document into the individual files, retaining header and footers. |
| 5 | 0 comments | [Show & Tell] Jam for All BASIC Dialects |
r/vba • u/kay-jay-dubya • 20d ago
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 • u/Former_Ad_5957 • 20d ago
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.
r/vba • u/Dependent_Garden_802 • 23d ago
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 • u/angedell • 24d ago
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.