YAML File Toolbox for MS Access β Readable AND Powerful
INI is simple, XML is powerful β YAML combines the best of both worlds: clean, human-readable syntax with hierarchical structures, arrays and UTF-8. This VBA toolbox brings YAML to MS Access: 13 functions, pure VBA, 32/64-bit.
In Part 1 we looked at INI files, in Part 2 at XML. Now comes the next evolution: YAML. INI is great for simple settings, XML is powerful β but YAML combines the best of both worlds:
- Simple and readable β clean syntax without excessive tags or brackets.
- Hierarchical β just like XML, but much more elegant.
- UTF-8 β all languages, special characters and emojis.
- Industry standard β Docker, Kubernetes, Ansible, GitHub Actions.
- Compact β less overhead than XML.
INI vs. XML vs. YAML β the big comparison
| Feature | INI | XML | YAML |
|---|---|---|---|
| Readability | βββββ excellent | βββ good | βββββ excellent |
| File size | βββββ very small | ββ large | ββββ small |
| Learning curve | βββββ very easy | βββ medium | ββββ easy |
| Hierarchy | β only 2 levels | β unlimited | β unlimited |
| UTF-8 support | β οΈ limited | β full | β full |
| Comments | β
; | β
<!-- --> | β
# |
| Data types | β only strings | β οΈ with schema | β built-in |
| Arrays/lists | β no | β οΈ verbose | β native |
| Validation | β no | β schema (XSD) | β schema (JSON) |
| Industry adoption | βββ legacy | ββββ high | βββββ very high |
| Windows native | β built-in API | β MSXML | β no native |
| Speed (VBA) | βββββ very fast | βββ medium | ββββ fast |
| Best for | simple configs | complex data exchange | modern configs |
When to use what?
- INI β ultra-simple configuration (just key-value), maximum performance, no hierarchy.
- XML β complex nested structures (> 2 levels), data exchange with external systems, schema validation, XSLT.
- YAML β human-readable configuration with hierarchy, modern toolchains, arrays and data types, small files, easy version control.
The 13 functions of the toolbox
All functions use late binding (no references required) and work in all Access versions (32/64-bit).
1. YML_ReadValue β read values.
strBackendPath = YML_ReadValue(strYmlPath, "Database", "BackendPath", "") 2. YML_WriteValue β write/update values. Creates the file and section automatically; special characters are escaped automatically.
YML_WriteValue strYmlPath, "Database", "BackendPath", strSelectedPath 3. YML_PrintAll β print the complete file.
YML_PrintAll CurrentProject.Path & "\config.yml" 4. YML_GetSections β list all sections.
Set colSections = YML_GetSections(strYmlPath)
For Each varSection In colSections
Debug.Print "Found section: " & varSection
Next 5. YML_GetKeys β all keys of a section.
Set colKeys = YML_GetKeys(strYmlPath, "Database")
For Each varKey In colKeys
Debug.Print varKey & " = " & YML_ReadValue(strYmlPath, "Database", CStr(varKey))
Next 6. YML_DeleteSection β delete an entire section.
If YML_SectionExists(strYmlPath, "OldModule") Then
YML_DeleteSection strYmlPath, "OldModule"
End If 7. YML_DeleteKey β delete a single key.
YML_DeleteKey strYmlPath, "Session", "TempPassword" 8. YML_SectionExists β check a section.
If Not YML_SectionExists(strYmlPath, "DatabaseV2") Then
' create the section ...
End If 9. YML_KeyExists β check a key.
If Not YML_KeyExists(strYmlPath, "Features", "AutoBackup") Then
YML_WriteValue strYmlPath, "Features", "AutoBackup", "True"
End If 10. YML_PrintStructured β structured output.
YML_PrintStructured strYmlPath 11. YML_GetAllValues β dictionary of all values.
Set dictDB = YML_GetAllValues(strYmlPath, "Database")
Debug.Print "Server: " & dictDB("Server")
Debug.Print "Port: " & dictDB("Port")
Debug.Print "Timeout: " & dictDB("Timeout") 12. YML_ValidateFormat β validate the format.
If Not YML_ValidateFormat(strImportedYmlPath) Then
MsgBox "The imported configuration is invalid!", vbCritical
End If Checks include: file exists and is readable Β· YAML is well-formed Β· no duplicate sections Β· no duplicate keys within a section Β· all sections and keys have names.
13. YML_Compare β compare two YAML files.
If Not YML_Compare(strOldConfig, strNewConfig) Then
Debug.Print "Changes detected - see details in the Immediate Window"
End If Real-world use cases
Multi-backend support:
YML_WriteValue strYmlPath, "Backends", "Production", "\\Server\DB\Prod.accdb"
YML_WriteValue strYmlPath, "Backends", "Test", "\\Server\DB\Test.accdb"
YML_WriteValue strYmlPath, "Backends", "Development", "C:\Dev\DB.accdb"
YML_WriteValue strYmlPath, "Settings", "CurrentEnvironment", "Production" Resulting YAML:
Backends:
Production: "\\\\Server\\DB\\Prod.accdb"
Test: "\\\\Server\\DB\\Test.accdb"
Development: "C:\\Dev\\DB.accdb"
Settings:
CurrentEnvironment: ProductionSettings with arrays β YAML is perfect for lists (color themes, server lists, feature flags):
YML_WriteValue strYmlPath, "UI", "AvailableThemes", "[Light, Dark, HighContrast]"
YML_WriteValue strYmlPath, "UI", "CurrentTheme", "Dark"
YML_WriteValue strYmlPath, "UI", "PrimaryColors", "[#FF0000, #00FF00, #0000FF]" Resulting YAML:
UI:
AvailableThemes: "[Light, Dark, HighContrast]"
CurrentTheme: Dark
PrimaryColors: "[#FF0000, #00FF00, #0000FF]"User preferences with UTF-8:
YML_WriteValue strYmlPath, "UI", "Language", "DE"
YML_WriteValue strYmlPath, "UI", "Theme", "Dark"
YML_WriteValue strYmlPath, "UI", "WelcomeMessage", "Willkommen zurΓΌck, MΓΌller!"
YML_WriteValue strYmlPath, "Export", "DefaultFolder", "C:\Users\Marcus\Exports" Resulting YAML:
UI:
Language: DE
Theme: Dark
WelcomeMessage: "Willkommen zurΓΌck, MΓΌller!"
Export:
DefaultFolder: "C:\\Users\\Marcus\\Exports"The advantages at a glance
- Update-proof, UTF-8 capable and readable (clean syntax without XML tags).
- Industry standard (Docker, Kubernetes, CI/CD) and compact (smaller than XML).
- 32/64-bit, no dependencies (pure VBA, late binding), with auto-escaping, comments (
#) and inline arrays like[1, 2, 3].
This completes the trilogy on configuration file formats β INI, XML and YAML. Depending on your use case, you now have the right tool.
Just give it a try
Using the included testing form you can try the functions directly. Youβll find the detailed description directly in the code, well documented as usual.
Download
A VBA toolbox for MS Access with 13 functions for YAML files: readable and hierarchical, with arrays and UTF-8 β read, write, validate and compare, without any references.




