🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #17662

Re: Get width and height of selected Rectangle [VB}

#17662
From: Dennis Hillen
Date: Thu, 22 May 2003 00:38
41 lines
2143 bytes
Well, I thought it was simple.

I am getting a "Type mismatch" on the line: "myWidth = myX2 - myX1".

Can someone tell me why? Here is the code:

Dim myInDesign As InDesign.Application
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.ActiveDocument

If myInDesign.Selection.Count > 0 Then
    Set mySelection = myInDesign.Selection
    Select Case TypeName(mySelection.Item(1))
        Case "Rectangle"
            Set myFrame = mySelection.Item(1)
            myY1 = myFrame.GeometricBounds(0)
            myX1 = myFrame.GeometricBounds(1)
            myY2 = myFrame.GeometricBounds(2)
            myX2 = myFrame.GeometricBounds(3)
            myStrokeWeight = myFrame.StrokeWeight
            MsgBox myStrokeWeight
            myWidth = myX2 - myX1
            myHeight = myY2 - myY1
            MsgBox "Width = " & myWidth & vbCrLf & _
            "Height = " & myHeight & vbCrLf & _
            "Stroke weight = " & myStrokeWeight
            End
        Case "TextFrame"
            MsgBox "Found Text Frame."
            End
        Case Else
            MsgBox "Must have Rectangle or Text Frame selected."
            End
    End Select
Else
    MsgBox "Must have Rectangle or Text Frame selected."
    End
End If

Cheers,
Dennis
Technical Details
Message-ID: <1de93496.3@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de93496.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,9b520f00cffeb790
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-05-21 18:07:40 PST
From: "Dennis Hillen" <hillend@tcp.newsltd.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Get width and height of selected Rectangle [VB}
Message-ID: <1de93496.3@WebX.la2eafNXanI>
Date: Wed, 21 May 2003 17:38:27 -0700
References: <1de93496.-1@WebX.la2eafNXanI>
Lines: 41
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit