Trouble setting grids

Discussion created by patrick.cashman on Oct 20, 2009
Latest reply on Oct 6, 2010 by lanie

I'd like to create a side pallette that has a bunch of buttons to quickly set placement, routing, and via grids.  I've been working on the following code:


Option Explicit


Dim app
Dim doc
Dim edcontrol
Dim gridval


Scripting.AddTypeLibrary ("MGCPCB.Application")


Call Main


Sub Main()


    Set app = GetObject(, "MGCPCB.Application")
    Set doc = GetLicensedDoc(app)
    Set edcontrol = doc.EditorControl
    gridval = .1
    edcontrol.Grid(6, 2) = gridval

    MsgBox "The via grid is now " & gridval
End Sub


This results in an unrecoverable error which shuts down Expedition:




Any ideas why it's not working would be much appreciated.