The TFE and variant variable experiment.
-
Visual Basic and Visual Basic for Applications allow variables to be
declared as a specific type,
- or to be a general purpose type called Variant,
if you do not explicitly declare them to be a specific type.
- Variant variables take more bytes of memory and are slower than
the variable of the specific type.
- This experiment will show that their is a cost to not declaring
variables - the program will use more memory and will run slower.
- TFE stands for Time For Execution. The TFE will be greater when
the variable is not declared As Single or As Long or As Integer.
-
Use the Alt+PrintScreen technique to capture EACH of the message box
TFE results on the Windows Clipboard.
Paste the 5 different message boxes into some
application, such as Microsoft Word or even on an Excel spreadsheet.
Turn in this printout of the results of your experiment.
-
Due date: Before Thanksgiving break.
- Turn in the printout of your VBA code and a table showing
the 5
different times for execution (TFE). Note that TFEs will vary depending
on what computer you run the program. Older computers with slower memory
and/or slower CPUs will obviously have different times for execution than
newer computers. With the table of 5 times, discuss why the times vary so
much by utilizing lecture notes from Thursday, September 23rd and your
understanding of the Dim statement and Variant variables.