- Inititally the idea was to have a repository, for the
personal.xlsb
. - Then it grew bigger.
- Then I read an article about Hungarian Notation and I have decided to use it.
- Then I read what Joel thought about it and it and I have decided to abandon it completely.
- Now (since 2018 or so) it is pretty much anything good that I write, that could be reused, so I do not have to reinvent the wheel every week. If I have to reuse it, I sometimes change the naming convention, avoiding the bad Hungarian notation and the
bad_naming_with_underscores_which_i_was_using_before
. - One day (probably never), when I have time I would group them in a better way.
- Until then, I would use the search option.
- Feel free to do the same.
- Pull requests are welcomed.
Good luck, have fun from VitoshAcademy
🐱🐶🐦🍦☀️
Building a boilerplate, which is to be used by as a start point for every VBA project was long in my mind. Somewhere in 2016 I have decided to put all the useful VBA code that I am using in a single repository. That repository used to "live" here - https://github.com/VBoilerplate/Boiler.
But then it come back to the repo you are currently reading from. Keep on moving!
🌵🐔🍹🦁🐉
Boilerplate is an Excel binary file with VBA code in it, which can be used for every new VBA project as a boilerplate. Building a boilerplate, which is to be used by as a start point for every VBA project was long in my mind. Somewhere in 2016 I have decided to put all the useful VBA code that I am using in a single repository.
The repository is https://github.com/Vitosh/VBA_personal, and up to now it has more than 60+ ⭐ in GitHub and just 1 contributor except me. The reason for this is that it probably looks a bit unstructured and I am the only one who can somehow find his way among all these files. Anyway, this week I am having some free time, thus I have decided to restart the project again - create an Excel binary file with VBA code in it, which can be used for every new VBA project as a boilerplate.
On February 2020 I have decided to change the repository to the current one: https://github.com/VBoilerplate/Boiler
Simply download it and use it! Or go through the files in and check them. If you find something interesting, copy it to your project.
On the current document and here - vitoshacademy.com/boilerplate
- ConstantsAndPublic
- The module provides a list of the used public constants in the whole project. Including one public variable, which is used to build the error report
- ExcelAdditional
- Various useful procedures are here. They somehow do not belong anywhere else so far:
- FreezeRow
- UnfreezeRows
- SumArray
- ChangeCommas
- BubbleSort
- IsArrayAllocated
- RangeIsZeroOrEmpty
- MakeRandom
- IsRangeHidden
- ColumnNumberToLetter
- IsValueInArray
- Rgb2HtmlColor
- NamedRangeExists
- GetRgb
- CopyValues
- OnEnd
- OnStart
- Various useful procedures are here. They somehow do not belong anywhere else so far:
- ExcelDates
- Dates were always tough for Excel users. These were tested for quite a long time.
- GetLastDayOfMonth
- GetFirstDayOfMonth
- AddMonths
- AddMonthsAndGetFirstDate
- DateDiffInMonths
- Dates were always tough for Excel users. These were tested for quite a long time.
- ExcelFormatCell
- Formatting a cell in Excel can be done in various ways. These are some quick ones:
- FormatAsDate
- FormatAsPercent
- FormatAsCurrency
- FormatAsEurProM2
- FormatRedAndBold
- WhiteRows
- WhiteCell
- FormatFontColorToGrey
- Formatting a cell in Excel can be done in various ways. These are some quick ones:
- ExcelLastThings
- Last row, last column, etc... in Excel are a must, when you are working with VBA. Make sure that you are aware, that some of the code ignores hidden ranges:
- LastColumn
- LastRow
- LastUsedColumn
- LastUsedRow
- LocateValueRow
- LocateValueCol
- Increment
- Decrement
- Last row, last column, etc... in Excel are a must, when you are working with VBA. Make sure that you are aware, that some of the code ignores hidden ranges:
- ExcelPrintToNotepad
- Printing to a .txt file is a feature that everyone needs. The file is in ThisWorkbook.Path & "\Info folder.
- PrintToNotepad
- CodifyTime
- MakeAllValues
- Printing to a .txt file is a feature that everyone needs. The file is in ThisWorkbook.Path & "\Info folder.
- ExcelStructure
- Changes in the structure of Excel are found here. Named ranges, printing PDFs, working with comments, styles, resetting and unlocking stuff is found here
- LockScroll
- StyleKiller
- DeleteName
- CoverRange
- PrintActiveSheetPDF
- PrintPage
- DeleteDrawingObjects
- UnhideAll
- UnprotectAll
- HideNeededWorksheets
- AddCommentToSelection
- PrintArray
- PrintAllNames
- DeleteAllNames
- DeleteCommentInSelection
- SelectMeA1RangeEverywhere
- HideShowComments
- ResetAndUnlock
- EnableMySaves
- DisabledCombination
- DisableShortcutsAndSaves
- Changes in the structure of Excel are found here. Named ranges, printing PDFs, working with comments, styles, resetting and unlocking stuff is found here
- ExcelVBE
- Be careful here. In general, this one could be dangerous, as far as it has one sub named ImportModules. It imports all the modules from a given folder to a given workbook. The "problem" is that before importing these, it deletes all other modules there. Just make sure that you know what you are doing, before using any of the subs from there.
- PrintAllCode
- PrintAllContainers
- ListProcedures
- ExportModules
- GetFolderOnDesktopPath
- CreateFolderOnDesktop
- ImportModules
- DeleteAllVba
- Be careful here. In general, this one could be dangerous, as far as it has one sub named ImportModules. It imports all the modules from a given folder to a given workbook. The "problem" is that before importing these, it deletes all other modules there. Just make sure that you know what you are doing, before using any of the subs from there.
- FormExample
- FormSummaryPresenter
- FrmExample
- FrmInfo
- The above four a combined together. To run the form, call "ShowMainForm". It does the rest. The forms are built, as in the article here - the perfect userform
- tblInput (Input)
- There is 1 sub for selection_change in this one. It checks the Zoom.
- tblSettings (Settings)
- Nothing in this one. It is by default xlVeryHidden. Its idea is to put some data inside, avoiding the data in ConstantsAndPublic.
- TddMain
- TddSpecDefinition
- TddSpecExpectation
- TddSpecInlineRunner
- TddSpecSuite
- The 5 modules and classes above are a framework taken from here, with some small changes. TddMain is where the tests are.
- VersionsAbout
- Well, this is #VBA. I have seen lots of projects, where the versioning is inside, hidden in a module. This is probably not a good practice (again!). But so these stay there.
- xl_main
- Workbook_BeforeClose
- Workbook_BeforeSave
- Workbook_NewSheet
- Workbook_Open
🌵🐱🐶🐒