Graphics Drawing Library for Excel VBA by using AddShape Instructions
Reason for development
VBA(Visual Basic for Applications) attached to Excel is a mechanism to add a function to process complex operations in spreadsheet automatically. It has long been known that it can be fully used as a pure programming language. VBA has the advantage of being available in most PC lab because VBA comes with widely used Excel.
However, lack of standard functions for graphics drawing is a major drawback for a programming environment for beginners. Therefore, graphics drawing subprocedures using the AddShape command are newly defined as a module of Excel VBA. By providing it as a library, even beginners can use it easily. Using this library makes it possible to create a practical program that involves drawing. The source program is available for free.
Excel on Microsoft Windows and OS X (macOS)
※ Some versions of Excel may not support graphics drawing in VBA.
- Three types of graphics library are provided: "Graphics with physical coordinates", "Graphics with world coordinates", and "Turtle graphics"
- In "Graphics with world coordinates", the drawing area and coordinate system can be freely set by defining the range of viewport and drawing window by yourself.
- In Turtle graphics, you can use drawing instructions similar to LOGO.
- When the number of drawing objects is very large, the processing speed may drop sharply from a certain stage. If you increase the number of drawing objects extremely, Excel may terminate abnormally depending on the environment of your computer.
- If the proportion of drawing commands in a program is extremely large, control such as interrupt or cancel during execution may not be effective.
It is recommended to use the library using GDI32 instructionsn when you use many drawing objects or you need the execution speed.