How to make basic macro loop?

I have never made a macro before but I have a command want to repeat with a loop. All i need to do is add 500 ft in x direction each time. Can anyone tell me why this wouldn't work ?? 

Sub main

Dim startPoint As MbePoint
Dim point As MbePoint, point2 As MbePoint

' Coordinates are in master units
startPoint.x = 1131371.644684#
startPoint.y = 97271.924289#
startPoint.z = 0.000000#


Do while i < 200

point.x = startPoint.x +500.000000*i
point.y = startPoint.y
point.z = startPoint.z
point2.x = point.x + 300.000000#
point2.y = point.y - 80.000000#
point2.z = point.z
MbeSendDragPoints point, point2, 1%

' Start a command
MbeSendCommand "MeasureArea ICON "

point.x = startPoint.x + 650.000000*i
point.y = startPoint.y + 0.000000#
point.z = startPoint.z
MbeSendDataPoint point, 1%

point.x = startPoint.x + 650.000000*i
point.y = startPoint.y - 105.000000#
point.z = startPoint.z
MbeSendDataPoint point, 1%

' Send a reset to the current command

i = i+1


End Sub

No Data
  • In addition to Jesse's comment about righ forum, please follow best practices and specify also product version. It seems you are using MicroStation BASIC, which is not recommended to use (because obsolete and not developed anymore for last more than 10 years). You should use MicroStation VBA instead of it.

    Another (very important in my opinion) recommendation is to use Insert > Insert code tool every time you want to share even one line of code. To read code snippet formated as normal text is annoying.

    With regards,


No Data