VBA Best Practice
There is a lot of information floating around about how to get various things done in VBA, how to make the best use, or sometimes just the most use of VBA and Excel.
This section aims to add an element of Quality and Best Practices. These are just general guidelines, a professional developer will always assess the options and make the appropriate choice in their specific situation.
These suggestions are specific to Excel VBA in commercial settings, many will not translate to other technologies or other settings.
VBA Best Practice Series
Debugging and Testing
- Immediate window
- Debug.print debug.assert
- Pre-conditions and post conditions
- Use a 'test' module, and application.run for private routines
- Test early and test often
- Keep all test code - it can act as a specification, and can give comfort that later changes do not break anything
- Get good test data - realistic, test full range including boundary conditions, but weight testing towards real world use.
- Execution testing v static testing and code inspection/review.
- Unit testing, system testing, user acceptance testing.
25 January 2012 - UK Excel Developer Conference - London
Products for sale:
New information about the missing FileSearch feature in Office 2007 and details of our pragmatic solution (Current price GBP 30.00)
Instant Excel worksheet protection remover and password recovery (Current price GBP 15.00)
Classic Ribbon Tab
Add Excel 97/2000/2002/2003 compatible menu structure to Excel 2007
(Current Price GBP 10.00)
Products coming soon:
(Find and control external links in Excel Workbooks)
Due by Q1 2111.
(Excel VBA based spreadsheet auditing tool)
Due before the end of 2111.