Results 1 to 2 of 2

Thread: Variant Question

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    13

    Variant Question

    My object browser says

    VisibleBounds As Variant
    Member of InDesign.PageItem
    The bounds of the page item including the stroke.

    So, why does the following code give me a "type Mismatch: 'PageBounds'"?

    Set myIndesign = CreateObject("Indesign.Application.2.0")
    Set Doc12up = myInDesign.ActiveDocument

    'Loop through each selected item
    For x = 1 To Doc12up.Selection.Count
    'set oPageItem object to item in pageitems collection
    Set oPageItem = Doc12up.Selection.Item(x)

    If TypeName(oPageItem.Parent) = "Page" Or TypeName(oPageItem.Parent) = "Spread" Then
    Set CurrentPage = oPageItem.Parent
    If TypeName(CurrentPage) = "Spread" Then
    Set CurrentPage = CurrentPage.Pages.Item(1)
    End If


    PageBounds() = oPageItem.VisibleBounds
    PageWidth = PageBounds(3) - PageBounds(1)
    PageHeight = PageBounds(2) - PageBounds(0)

    End If
    Next

  2. #2
    Addicted Member
    Join Date
    Sep 2009
    Location
    The Netherlands
    Posts
    148

    Re: Variant Question

    I'm fairly new to VB but what if you try to declare PageBounds as follows:

    Code:
    PageBounds() = oPageItem.VisibleBounds
    PageWidth = cInt(PageBounds(3)) - cInt(PageBounds(1))
    PageHeight = cInt(PageBounds(2)) - cInt(PageBounds(0))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width