I wrote some function to add some polylines to Excel sheet. Then I've discovered strange braces behavior. I declare and define points array as this:
Dim points As Variant
Dim sh As Shape
points = Array(Array(10.5, 10.5), Array(20.4, 20.4), Array(5.1, 30.3), Array(10.5, 10.5))
' These both do not work and I get error about wrong type (error 1004) in 2007
' and application defined error 1004 on 2010:
ActiveWorkbook.ActiveSheet.Shapes.AddPolyline points
Set sh = ActiveWorkbook.ActiveSheet.Shapes.AddPolyline(points)
' These work fine:
ActiveWorkbook.ActiveSheet.Shapes.AddPolyline (points)
Set sh = ActiveWorkbook.ActiveSheet.Shapes.AddPolyline((points))
What is the strange magic of VBA braces?
Tested in 2007 and 2010 versions.