Code Monkey home page Code Monkey logo

vba_personal's Introduction

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 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

πŸ±πŸΆπŸ¦πŸ¦β˜€οΈ

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.

But then it come back to the repo you are currently reading from. Keep on moving!

πŸŒ΅πŸ”πŸΉπŸ¦πŸ‰

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+ ⭐ 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:

Where is the official documentation?

On the current document and here - 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
  • 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

πŸŒ΅πŸ±πŸΆπŸ’

Thanks for all the stars! ⭐⭐⭐

vba_personal's People

Contributors

decimalturn avatar robson avatar vitosh avatar vittemp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vba_personal's Issues

After running the code, there is a error shows up, and I add a line "On Error Resume Next", then the error gone.

Below is the error Infos, Sorry for the Chinese error message.
image

Anyway, I added a line there, then the issue is gone, I am not sure whether it will affect other parts of the whole script. The code I add below is like this:
image

I am just a newbie of using VBE, and I really thank you for your code, it really helps. I can see you really do a lot of things with VBA on Github, that's so exciting.

Best regards
Jesse

[AttributesInVBA] - Overloaded default procedure?

Is it possible to create an overloaded default procedure?

So you could do something like this:
------------ Class ------------

'...
Public Function DefaultProc() As Something
	Attribute '...
	'...
End Function

Public Function DefaultProc(ByVal myNumber As Integer) As Something
	Attribute '... ??
	'...
End Function

Public Function DefaultProc(ByVal myString As String) As Something
	Attribute '... ??
	'...
End Function
'...

------------ Main ------------

Dim Instance As New MyClass
Debug.Print Instance
Debug.Print Instance("Joe")
Debug.Print Instance(1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.