├── .gitattributes ├── .github └── workflows │ ├── enforce_crlf.yml │ ├── lint_vba.yml │ └── vba_docs_gen.yml ├── .gitignore ├── .vscode └── settings.json ├── LICENSE ├── Links.md ├── README.md ├── Templates └── ClassTemplate.cls ├── Tools ├── VBALibraries Extract │ ├── README.md │ ├── VBALibraries.ahk │ ├── VBALibraries.json │ ├── VBALibraries.min.json │ └── libs │ │ └── JSON.ahk └── VBDocsGen │ └── main.js ├── VBA-STD.code-workspace ├── changelog.md ├── contribution.md ├── docs.json ├── docs ├── WIP │ ├── STD_Types_String.md │ ├── STD_Types_StringBuilder.md │ ├── ShWapi.md │ ├── VBAMemoryAnalysis.txt │ ├── VBAMemoryAnalysis2.txt │ ├── WinMgmt.md │ ├── stdCOM.md │ ├── stdCallback.md │ ├── stdCrypto.md │ ├── stdDLL.md │ ├── stdSerialisedVBA.md │ └── stdThreads.md ├── _config.yml ├── assets │ ├── Status_G.png │ ├── Status_R.png │ ├── Status_Y.png │ ├── changeLogAnalysis.xlsx │ ├── changesHeatMap.png │ ├── icon.png │ ├── icons.pptx │ ├── social.png │ └── stdProcess-Priority.png ├── stdAcc.md ├── stdEnumerator.md ├── stdHTTP.md ├── stdLambda.md ├── stdProcess.md └── stdWindow.md ├── fullBuild.xlam ├── fullBuild.xlsm ├── logs └── xvba_debug.log ├── src ├── WIP │ ├── .DS_Store │ ├── JSONLogic.cls │ ├── Pointers │ │ ├── stdPointer v2.cls │ │ └── stdPointer.cls │ ├── STD_Runtimes_CLR.cls │ ├── ideas │ │ └── random.md │ ├── stdCOMDispatch.cls │ ├── stdCOM_Pointer │ │ └── callbyname_thunk_x64.asm │ ├── stdCallback2.cls │ ├── stdCanvas.cls │ ├── stdCrypto │ │ ├── MD5.cls │ │ └── stdCrypt.cls │ ├── stdDLL │ │ ├── README.md │ │ ├── inspiration │ │ │ └── cUniversalDLLCalls.cls │ │ └── stdDll.md │ ├── stdDate.cls │ ├── stdDictionary │ │ ├── README.md │ │ ├── SS │ │ │ └── stdDictionary2.cls │ │ ├── stdDictionary.cls │ │ ├── stdIHashable.cls │ │ └── trick │ │ │ └── stdDictionary.cls │ ├── stdEndpoint.cls │ ├── stdEnumProvider │ │ ├── FibonacciIteratorExample.cls │ │ ├── README.md │ │ └── STD_Types_IniVariantEnum.bas │ ├── stdError │ │ ├── README.md │ │ ├── stdDebug.cls │ │ └── stdError.cls │ ├── stdErrorWIP.cls │ ├── stdExcelLibraries │ │ ├── stdExcelWorkbook.cls │ │ ├── stdExcelWorksheet.cls │ │ ├── stdShapeEvents.cls │ │ └── stdXLEvents.cls │ ├── stdGithub.cls │ ├── stdHTTPServer.cls │ ├── stdIResource.cls │ ├── stdIni.cls │ ├── stdMath.cls │ ├── stdObject │ │ ├── IFauxInterface.cls │ │ ├── README.md │ │ └── stdObject.cls │ ├── stdOpenCL │ │ └── stdOpenCL.cls │ ├── stdRegex2.cls │ ├── stdResource.cls │ ├── stdRibbon.cls │ ├── stdRuntimeJS.cls │ ├── stdSettings.cls │ ├── stdSharepointSite.cls │ ├── stdShell.cls │ ├── stdString.cls │ ├── stdStringBuilder.cls │ ├── stdStruct.cls │ ├── stdTable │ │ ├── stdITable.cls │ │ ├── stdITableRow.cls │ │ ├── stdRow v0.0.1.cls │ │ ├── stdTable.cls │ │ ├── stdXLEvents.cls │ │ ├── stdXLTable.cls │ │ ├── stdXLTableRow.cls │ │ └── testStdTable.xlsm │ ├── stdTimer.cls │ ├── stdTimerServerWIP.bas │ ├── stdUI │ │ └── stdUI.md │ ├── stdUIAutomationElement.cls │ ├── stdWebSocket │ │ ├── README.md │ │ ├── stdWebSocket.cls │ │ └── stdWebSocketNew.cls │ ├── stdWordLibraries │ │ └── stdWordDocument.cls │ ├── stdXML.cls │ └── stdZip │ │ └── stdZip.md ├── stdAcc.cls ├── stdArray.cls ├── stdCOM.cls ├── stdCallback.cls ├── stdClipboard.cls ├── stdEnumerator.cls ├── stdFiber.cls ├── stdHTTP.cls ├── stdHTTPAuthenticators.bas ├── stdICallable.cls ├── stdImage.cls ├── stdJSON.cls ├── stdLambda.cls ├── stdPerformance.cls ├── stdProcess.cls ├── stdQuadTree.cls ├── stdRefArray.cls ├── stdReg.cls ├── stdRegex.cls ├── stdSentry.cls ├── stdTimer.cls ├── stdUIElement.cls ├── stdWebSocket.cls └── stdWindow.cls ├── testBuilder.xlsm └── tests ├── Main.bas ├── lib ├── ImmediateWindow │ └── Test.cls ├── Test.cls └── xlsProjectBuilder.cls ├── stdAccTestHelper.cls ├── stdAccTests.bas ├── stdArrayTests.bas ├── stdCallbackTests.bas ├── stdClipboardTests.bas ├── stdEnumeratorTests.bas ├── stdHTTPTests.bas ├── stdLambdaTests.bas ├── stdPerformanceTests.bas ├── stdProcessTests.bas ├── stdRegexTests.bas ├── stdSentryTests.bas ├── stdStringBuilderTests.bas ├── stdWebSocketTests.bas └── stdWindowTests.bas /.gitattributes: -------------------------------------------------------------------------------- 1 | # By default, auto detect text files and perform LF normalization 2 | * text=auto eol=lf 3 | 4 | # VBA extensions - Prevent LF normalization 5 | *.bas -text diff 6 | *.cls -text diff 7 | *.frm -text diff 8 | 9 | # VBA extensions - Mark as binary 10 | *.frx binary 11 | 12 | # AutoHotKey 13 | *.ahk -text diff 14 | -------------------------------------------------------------------------------- /.github/workflows/enforce_crlf.yml: -------------------------------------------------------------------------------- 1 | name: Enforce-CRLF 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | permissions: 10 | contents: write 11 | 12 | jobs: 13 | enforce-crlf: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Enforce CRLF action 17 | uses: DecimalTurn/Enforce-CRLF@ec751ecfeb0e0cf51d19f295435c7a6ec10bac15 #v1.1.3 18 | with: 19 | extensions: .bas, .frm, .cls 20 | do-checkout: true 21 | do-push: true 22 | 23 | -------------------------------------------------------------------------------- /.github/workflows/lint_vba.yml: -------------------------------------------------------------------------------- 1 | name: Lint VBA 2 | 3 | on: 4 | push: 5 | branches: 6 | - linting 7 | jobs: 8 | test-and-static-analysis: 9 | name: Test and Static Analysis 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | - name: Install 14 | run: | 15 | python -m pip install --upgrade pip 16 | pip install 'vba_precompiler @ git+https://github.com/Beakerboy/VBA-Precompiler@main' 17 | - name: Precompile 18 | run: | 19 | rm -rf ./src/WIP 20 | python -m vba_precompiler -v7 -sWin64 ./src 21 | rm -rf ./src 22 | - name: Lint 23 | uses: Vba-actions/lint-vba@dev 24 | -------------------------------------------------------------------------------- /.github/workflows/vba_docs_gen.yml: -------------------------------------------------------------------------------- 1 | on: [push] 2 | 3 | jobs: 4 | build-and-publish: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Checkout repository 8 | uses: actions/checkout@v3 9 | 10 | - name: Setup Node.js 11 | uses: actions/setup-node@v4 12 | with: 13 | node-version: "20" 14 | 15 | - name: Run doc generator 16 | run: node ./Tools/VBDocsGen/main.js 17 | 18 | - name: Commit and push changes 19 | run: | 20 | git config user.name "GitHub Actions Bot" 21 | git config user.email "actions@github.com" 22 | git add docs.json 23 | git commit -m "Documentation update" || echo "No changes to commit" 24 | git push origin HEAD 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.eol": "\r\n", 3 | "[markdown]": { 4 | "editor.formatOnSave": false 5 | } 6 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 James Warren 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Links.md: -------------------------------------------------------------------------------- 1 | # Links 2 | 3 | Links containing useful 4 | 5 | 6 | 7 | # General Random 8 | 9 | * [Tips and Tricks](http://www.devx.com/tips/multimedia/visual-basic/) 10 | 11 | # General Advanced 12 | 13 | * [New style blog - Excel Development Platform](http://exceldevelopmentplatform.blogspot.com/) 14 | * [Free VB Code](http://www.freevbcode.com) 15 | 16 | ------------------------------------------------ 17 | 18 | ## Books 19 | 20 | * [McKinney's - Hardcore vba](http://vb.mvps.org/hardweb/mckinney.htm) 21 | 22 | ------------------------------------------------ 23 | 24 | ## Excel 4.0 Macro Language 25 | * [Reference](https://d13ot9o61jdzpp.cloudfront.net/files/Excel%204.0%20Macro%20Functions%20Reference.pdf) 26 | 27 | ------------------------------------------------ 28 | 29 | ## VB6 Attributes 30 | 31 | * [`Attribute` keyword info](https://stackoverflow.com/questions/33648764/what-does-the-attribute-keyword-do-in-vb6) 32 | 33 | ------------------------------------------------ 34 | 35 | ## VB6 MULTITHREADING: 36 | 37 | * [The trick's VB6 multithreading with `Kernel32::CreateThread`](http://www.vbforums.com/showthread.php?788327-VB6-Multithreading-in-VB6-part-1) 38 | * [A thread to Visual Basic: Multi-Threading in VB5 and VB6](http://www.freevbcode.com/ShowCode.asp?ID=1287) 39 | * [Multithreading System](http://www.vbforums.com/showthread.php?296315-New-code-for-simulating-multithreading-in-VB6&s=) - Note I think this requires an external DLL. 40 | 41 | ------------------------------------------------ 42 | 43 | ## ENUM Running Object Table (ROT): 44 | 45 | * [Last Post - Via Type library](http://www.vbforums.com/showthread.php?410736-Iterating-the-ROT-!) 46 | * [VB.NET Approach](https://hk.saowen.com/a/3cea58a630c5e2946b30c8d367cd334d20f9319462c410f90d35021d883de96d) 47 | * [Tom Schreiner's code for iterating through AutoCAD instances](https://www.mrexcel.com/forum/excel-questions/238257-loop-through-processes-2.html) 48 | * [C# example](https://adndevblog.typepad.com/autocad/2013/12/accessing-com-applications-from-the-running-object-table.html) 49 | * [AHK Example](https://www.autohotkey.com/boards/viewtopic.php?t=6494) 50 | * [COM Object from Moniker name in ROT](http://www.vbforums.com/showthread.php?743649-How-to-use-the-CoGetObject-API-function-in-VB6&p=4557819&viewfull=1#post4557819) 51 | 52 | ------------------------------------------------ 53 | 54 | ## COM Talk: 55 | 56 | ### General Concepts: 57 | * [Ext: Introduction to COM for VB programmers](http://www1.idc.ac.il/ed/An%20introduction%20to%20COM%20for%20VB%20programmers.htm) 58 | * [MSDN: IDispatchEx](https://docs.microsoft.com/en-us/scripting/winscript/reference/idispatchex-interface) 59 | * [MSDN: DISP IDs i.e. VB_UserMemID](https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms864423(v%3Dmsdn.10)) 60 | 61 | ### Libraries: 62 | * [VBF: DLL / COM object generalised function caller](http://www.vbforums.com/showthread.php?781595-VB6-Call-Functions-By-Pointer-(Universall-DLL-Calls)) 63 | * [VBF: Creating and Using COM interfaces without TypeLibraries](http://www.vbforums.com/showthread.php?785939-VB6-Creating-Using-COM-Interfaces-without-TLBs) 64 | * [FVBC: Determine if a property exists on a COM object](http://www.freevbcode.com/ShowCode.asp?ID=2441) 65 | * [VBF: DISPID_EVALUATE](http://www.vbforums.com/showthread.php?862105-FYI-How-to-impl-DISPID_EVALUATE-in-VB6) 66 | * [VBF: Analysis of type library](http://www.vbforums.com/showthread.php?800045-Undocumented-Function-using-VBA6-Dll&p=4902755&viewfull=1#post4902755) 67 | 68 | ------------------------------------------------ 69 | 70 | ## Structs / UDTs 71 | * [Serializing COM objects](http://exceldevelopmentplatform.blogspot.com/2018/12/vba-persistence-use-lset-to-serialise.html) 72 | 73 | ------------------------------------------------ 74 | 75 | ## Collections/Dictionaries 76 | 77 | * [Quick acces collections/dictionaries](http://www.vbforums.com/showthread.php?872627-How-to-access-object-in-collection-more-quickly&p=5370749#post5370749) 78 | 79 | * [Extensions to Dictionary: E.G. Sort, GetHash, GetItems, ... ](http://www.cyberforum.ru/post6040814.html) 80 | 81 | ## Machine Code: 82 | 83 | * [Execute MCode (OPCodes) from VB6](http://www.freevbcode.com/ShowCode.asp?ID=1863) 84 | 85 | # Non VBA Resources: 86 | 87 | ## Excel C API 88 | * [Could be useful for working with type libraries](https://docs.microsoft.com/en-us/office/client-developer/excel/programming-with-the-c-api-in-excel) 89 | -------------------------------------------------------------------------------- /Templates/ClassTemplate.cls: -------------------------------------------------------------------------------- 1 | VERSION 1.0 CLASS 2 | BEGIN 3 | MultiUse = -1 'True 4 | END 5 | Attribute VB_Name = "ClassTemplate" 6 | Attribute VB_GlobalNameSpace = False 7 | Attribute VB_Creatable = False 8 | Attribute VB_PredeclaredId = True 9 | Attribute VB_Exposed = True 10 | 11 | Public Function Create() as ClassTemplate 12 | set Create = new ClassTemplate 13 | Call Create.protInit() 14 | End Function 15 | 16 | Friend Sub protInit() 17 | 18 | End Sub -------------------------------------------------------------------------------- /Tools/VBALibraries Extract/README.md: -------------------------------------------------------------------------------- 1 | # VBALibraries.json 2 | 3 | This JSON file contains an exported list of Classes, Types and Modules, 4 | with each of their exported members for all standard Excel Libraries. 5 | 6 | This list was generated using `VBALibraries.ahk` which parses the 7 | object browser in the VBE. 8 | 9 | > Note: 10 | > The JSON files created by the tool may not be fully correct. 11 | > We are correcting the JSONs where conflicts are found. 12 | 13 | ## JSON Structure: 14 | 15 | ```js 16 | { 17 | "type": "Libraries", 18 | 19 | //All libraries 20 | "zChildren": [ 21 | { 22 | //Description of library as given by VBA 23 | "LibDescription": "Microsoft Excel 16.0 Object Library", 24 | 25 | //Name of library. Note: \r\n may be virtual here 26 | "LibName": "Excel\r\n", 27 | 28 | //Path of library 29 | "LibPath": "C:\\Program Files (x86)\\Microsoft Office\\Root\\Office16\\EXCEL.EXE", 30 | 31 | //Library Type (Library or Project) 32 | "LibType": "Library", 33 | 34 | //Children of this library (Mostly classes and modules) 35 | "zChildren": [ 36 | { 37 | //Name of class/module/namespace. Note: Global is a special module name denoting the global namespace 38 | "name": "Global", 39 | 40 | //Parent of object. Note: Global methods are always declared somewhere, and then elevated to global status. 41 | "parent": "Excel", 42 | 43 | //module/class - note for global this should likely be "Namespace" 44 | "type": "Class", 45 | 46 | //Description as provided by VBA 47 | "typeDescription": "", 48 | 49 | //All children of this member 50 | "members": [ 51 | { 52 | //Is the member the default member of the object (i.e. DISPID=0 / UserMemID=0 53 | "isDefault": false, 54 | 55 | //Is the property or value read only? 56 | "isReadOnly": true, 57 | 58 | //The member name 59 | "MemberName": "ActiveCell", 60 | 61 | //E.G. Property, Sub, Function, ... 62 | "MemberType": "Property", 63 | 64 | //ParamString if given (note this might also be member default value) 65 | "ParamString": "", 66 | 67 | //The parent of this member 68 | "Parent": "Excel.Global", 69 | 70 | //Return type if given (sometimes no return value is given) 71 | "RetType": "Range\r\n", 72 | 73 | //Raw text exported from Excel, used to infer the above data. 74 | "typeDescription": "Property ActiveCell As Range\r\n read-only\r\n Member of Excel.Global\r\n" 75 | },... 76 | ] 77 | }, ... 78 | ] 79 | },... 80 | ] 81 | } 82 | ``` 83 | -------------------------------------------------------------------------------- /Tools/VBALibraries Extract/VBALibraries.ahk: -------------------------------------------------------------------------------- 1 | ;Written in AHK 1.1.30.00 2 | 3 | 4 | #Include libs\JSON.ahk 5 | #SingleInstance,Force 6 | ControlGet, lb1, hwnd,, ListBox1, ahk_class wndclass_desked_gsk ahk_exe EXCEL.EXE 7 | ControlGet, lb2, hwnd,, ListBox2, ahk_class wndclass_desked_gsk ahk_exe EXCEL.EXE 8 | ControlGet, txt1, hwnd,, RichEdit20A1, ahk_class wndclass_desked_gsk ahk_exe EXCEL.EXE 9 | ControlGet, cb1, hwnd,, ComboBox1, ahk_class wndclass_desked_gsk ahk_exe EXCEL.EXE 10 | ControlGet, cb1_list, list,,ComboBox1, ahk_class wndclass_desked_gsk ahk_exe EXCEL.EXE 11 | 12 | libCount := 0 13 | Loop, Parse, cb1_list, `n 14 | libCount += 1 15 | 16 | i:=0, j:=0 17 | errLib:=0,errA:=0, errB:=0 18 | 19 | ;Main return object: 20 | libraries := {type:"Libraries",zChildren:[]} 21 | 22 | ;Start from first library... 23 | k:=1 ;Skip 0 () 24 | 25 | While k < libCount { 26 | ;Increment library item to target 27 | k +=1 28 | 29 | ;Get library 30 | ;Note: you need to show and hide the dropdown for the description field to update in this case... 31 | Control,Choose,%k%,, ahk_id %cb1% 32 | Control, ShowDropDown ,,, ahk_id %cb1% 33 | Control, HideDropDown ,,, ahk_id %cb1% 34 | library := parseLibrary() 35 | 36 | 37 | ErrA:=0,i:=0 38 | While errA==0 { 39 | ;Increment listbox item to target 40 | i += 1 41 | 42 | ;Try to get control: 43 | Control,Choose,%i%,, ahk_id %lb1% 44 | errA := ErrorLevel 45 | 46 | ;Get Parent: 47 | parent := parseParent() 48 | 49 | j:=0,errB:=0 50 | While errB==0 { 51 | ;Increment listbox item to target 52 | j+=1 53 | 54 | ;Try to get control 55 | Control,Choose,%j%,, ahk_id %lb2% 56 | errB:=ErrorLevel 57 | 58 | ;Parse member and append to parent 59 | parent.members.push(parseMember()) 60 | } 61 | 62 | ;Append parent and members to array: 63 | library.zChildren.push(parent) 64 | } 65 | 66 | ;Push library to libraries object 67 | libraries.zChildren.push(library) 68 | } 69 | 70 | ;Stringify and dump to VBALibraries.json 71 | sJSON := JSON.stringify(libraries) 72 | FileDelete,%A_ScriptDir%\VBALibraries.json 73 | FileAppend,%sJSON%, %A_ScriptDir%\VBALibraries.json 74 | 75 | msgbox Exporting VBALibraries has complete 76 | return 77 | 78 | 79 | 80 | parseParent(){ 81 | haystack := getDefinition() 82 | needle := "iO)(\)|([^ ]+) ([^ ]+)\s+Member of (.+)" 83 | RegexMatch(haystack,needle, oMatch) 84 | isGlobals := StrLen(oMatch.Value(1))>0 85 | 86 | if isGlobals { 87 | return {type: "global",name: "", parent:"", members:[],typeDescription:haystack} 88 | } else { 89 | type := oMatch.value(2) 90 | name := oMatch.value(3) 91 | parent:= oMatch.value(4) 92 | return {type: type, name:name, parent:parent, members:[],typeDescription:haystack} 93 | } 94 | 95 | } 96 | parseMember(){ 97 | haystack := getDefinition() 98 | needle = O)(?:(?[^ ]+) )?(?[^ (]+)\(?(?.*?)?\)?(?: As (?[^ ]+))?\s*(?:(?read-only))?\s*(?Default )?[mM]ember of (?.+) 99 | RegexMatch(haystack,needle, oMatch) 100 | isDefault := StrLen(oMatch.Default)>0 101 | isReadOnly := StrLen(oMatch.ReadOnly)>0 102 | MemberType := oMatch.MemberType 103 | MemberName := oMatch.MemberName 104 | ParamString:= oMatch.Params 105 | RetType := oMatch.RetType ? oMatch.RetType : "VOID" 106 | Parent := oMatch.Parent 107 | 108 | return {MemberType:MemberType,MemberName:MemberName,ParamString:ParamString,RetType:RetType,Parent:Parent,isDefault:isDefault,isReadOnly:isReadOnly,typeDescription:haystack} 109 | } 110 | parseLibrary(){ 111 | haystack := getDefinition() 112 | needle = O)(?[^ ]+) (?[^ ]+)(?:\s+(?.+)\s+(?.+))? 113 | RegexMatch(haystack,needle, oMatch) 114 | LibType := oMatch.LibType 115 | LibName := oMatch.LibName 116 | LibPath := oMatch.LibPath 117 | LibDescription := oMatch.LibDescription 118 | 119 | return {LibType:LibType,LibName:LibName,LibPath:LibPath,LibDescription:LibDescription,zChildren:[]} 120 | } 121 | 122 | 123 | getDefinition(){ 124 | global 125 | ControlGetText, text,, ahk_id %txt1% 126 | return text 127 | } -------------------------------------------------------------------------------- /VBA-STD.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | // The number of spaces a tab is equal to. This setting is overridden 9 | // based on the file contents when `editor.detectIndentation` is true. 10 | "editor.tabSize": 2, 11 | 12 | // Insert spaces when pressing Tab. This setting is overriden 13 | // based on the file contents when `editor.detectIndentation` is true. 14 | "editor.insertSpaces": true, 15 | 16 | // When opening a file, `editor.tabSize` and `editor.insertSpaces` 17 | // will be detected based on the file contents. Set to false to keep 18 | // the values you've explicitly set, above 19 | "editor.detectIndentation": false, 20 | 21 | //Match indentation on paste 22 | "editor.formatOnPaste": true, 23 | 24 | //Force \r\n on all files - must be the case for VBA. 25 | "files.eol": "\r\n" 26 | } 27 | } -------------------------------------------------------------------------------- /docs/WIP/STD_Types_StringBuilder.md: -------------------------------------------------------------------------------- 1 | # `Std.Types.StringBuilder` 2 | 3 | This class is used to build large VBA Strings. This includes features such as interpolation and employs the `DISPID_EVALUATE` attribute to provide a simple, easy to read and maintainable string building process. 4 | 5 | ## Usage Example: 6 | 7 | ### Test example: 8 | 9 | ```vb 10 | Dim sb As Object 11 | Set sb = StringBuilder.Create() 12 | sb.JoinStr = "-" 13 | sb.Str = "Start" 14 | sb.TrimBehaviour = RTrim 15 | sb.InjectionVariables.Add "@1", "cool" 16 | sb.[This is a really cool multi-line ] 17 | sb.[string which can even include ] 18 | sb.[symbols like " ' # ! / \ without ] 19 | sb.[causing compiler errors!! ] 20 | sb.[also this has @1 variable injection!] 21 | Test = sb.Str = "Start-This is a really cool multi-line-string which can even include-symbols like "" ' # ! / \ without-causing compiler errors!!-also this has cool variable injection!" 22 | ``` 23 | 24 | ### Building HTML: 25 | 26 | ```vb 27 | 'IMPORTANT!!! Only Object (aka "IDispatch") can use square bracket syntax! Therefore must define sb as object! 28 | Dim sb as Object 29 | set sb = StringBuilder.Create() 30 | sb.TrimBehaviour = RTrim 31 | 32 | 'Inject variables into string using the InjectionVariables dictionary: 33 | sb.InjectionVariables.add "{this.handleChange}", handleChange 34 | sb.InjectionVariables.add "{this.state.value}", state.value 35 | sb.InjectionVariables.add "{this.getRawMarkup()}", getRawMarkup() 36 | 37 | 'Build string 38 | sb.[
] 39 | sb.[

Input

] 40 | sb.[ ] 43 | sb.[