Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Vitosh/VBA_personal
Library with VBA, used in multiple projects.
https://github.com/Vitosh/VBA_personal
boilerplate excel vba vba-personal xlsb
Last synced: 9 days ago
JSON representation
Library with VBA, used in multiple projects.
- Host: GitHub
- URL: https://github.com/Vitosh/VBA_personal
- Owner: Vitosh
- Created: 2015-09-08T15:04:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-02-20T08:55:36.000Z (10 months ago)
- Last Synced: 2024-08-13T07:18:22.081Z (4 months ago)
- Topics: boilerplate, excel, vba, vba-personal, xlsb
- Language: VBA
- Homepage: https://www.vitoshacademy.com
- Size: 4.44 MB
- Stars: 145
- Watchers: 17
- Forks: 50
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - Vitosh/VBA_personal - Library with VBA, used in multiple projects. (VBA)
README
# VBA Personal
- Inititally the idea was to have a repository, for the `personal.xlsb`.
- Then it grew bigger.
- Then I read an article about [Hungarian Notation](https://en.wikipedia.org/wiki/Hungarian_notation) and I have decided to use it.
- Then I read [what Joel thought about it and it](https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/) 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](http://www.vitoshacademy.com):cat::dog::bird::icecream::sunny:
# VBA 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. That repository used to "live" here -
[https://github.com/VBoilerplate/Boiler](https://github.com/VBoilerplate/Boiler).But then it come back to the repo you are currently reading from.
Keep on moving!:cactus::chicken::tropical_drink::lion::dragon:
## The idea
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+ :star: 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.
## The structure
On February 2020 I have decided to change the repository to the current one:
https://github.com/VBoilerplate/Boiler## How can I use the boilerplate:
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.## Video tutorials:
## [YouTube VBA Boilerplate Tutorials](https://www.youtube.com/playlist?list=PLHvb-qAb0DaE2WXKfOXXNNRkoW990S5lP)## Where is the official documentation?
On the current document and here - [vitoshacademy.com/boilerplate](https://www.vitoshacademy.com/boilerplate/)## What is inside the 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
-
-
ExcelDates-
Dates were always tough for Excel users. These were tested for quite a long time.- GetLastDayOfMonth
- GetFirstDayOfMonth
- AddMonths
- AddMonthsAndGetFirstDate
- DateDiffInMonths
-
-
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
-
-
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
-
-
ExcelPrintToNotepad-
Printing to a .txt file is a feature that everyone needs. The file is in ThisWorkbook.Path & "\Info folder.- PrintToNotepad
- CodifyTime
- MakeAllValues
-
-
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
-
-
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
-
- 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
- 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.
- 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
:cactus::cat::dog::monkey:
## [If you decide to PayPal me, click here.](https://www.paypal.com/paypalme/vitoshacademy)
# Thanks for all the stars! :star::star::star: