Hello,
I would like to create rectangle in ID by VBA script and I have a problem with it. I am running the the scrip from Access and other elements (like setting page dimension and adding layers works fine but I can’t create rectangle.
My script looks like as follows:
Dim myInDesign As Object
Dim myDocument As Object
Dim myDocPref As Object
Dim myPage As Object
Dim myRectangle As Object
Dim myLayer As Object
Dim myY1 As Double
Dim myX1 As Double
Dim myY2 As Double
Dim myX2 As Double
‘
‘ Omitted part creating document, layers and so on…
‘
Set myLayer = myDocument.Layers.Add
myLayer.Name = “Sciezka”
myDocument.ActiveLayer = myDocument.Layers.Item(“Sciezka”)
myY1 = 0
myX1 = 0
myY2 = 20
myX2 = 20
Set myRectangle = myPage.Rectangles.Add
With myRectangle
.GeometricBounds = Array(myY1, myX1, myY2, myX2)
.FillColor = “Registration”
.StrokeColor = “None”
End With
Running the script gives error pointing that myRectangle variable is not defined while all previous object variables work fine.
Maybe I don’t understand something in declaring variable for object like rectangle, but I cannot figure out how it could be done.