Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undocumented vba special keywords - Circle and Scale

Tags:

syntax

vba

The VBA documentation defines the following token:

special-form = “Array“ / “Circle” / “Input” / “InputB” / “LBound” / “Scale” / “UBound”

According to the documemtation:

A special-form is a reserved-identifier that is used in an expression as if it was a program defined procedure name but which has special syntactic rules for its argument.

But there is no mention of the purpose of these keywords, nor there number, type of parameters and return values.

Some are documented in other places:

  • Array returns a literal array with an variable number of parameters
  • Input and InputB are used with line
  • LBound and Ubound returns respectively tho first and last index of an array, same as VB

My question is:
What is the purpose of Circle and Scale and how are they used ?

I found the correct (odd) syntax of Circle which is the same as the BASIC statement

CIRCLE(xcenter, ycenter), radius[,[color][,[start],[end][,aspect]]]

and gives no syntax error (I didn't find any mention of Scale though it doesn't seem to have any parameters) but I can't assign it to a variable, and if I try to run the code below (which is syntaxically correct) I get the following error:

Method not valid without suitable object

code:

Sub test1()
    Circle (5, 5), 10
End Sub

Sub test2()
    Scale
End Sub
like image 878
z̫͋ Avatar asked Apr 10 '14 10:04

z̫͋


1 Answers

VB inherited the odd syntax of graphics methods (what circle/scale are) from QBASIC and VBA further inherited them from VB (upon which it is based). Presumably it was decided that rather than removing the special parsing rules for these constructs in the runtime, it was simpler to leave them as a noop.

CREDIT TO Alex K. (see his comment)

like image 200
Smandoli Avatar answered Nov 11 '22 19:11

Smandoli