3 Replies Latest reply on Dec 6, 2010 1:08 PM by Jarema_IV

    [VB][CS5] Hyperlink on Rectangle problem - urgent

    Jarema_IV

      Hi there,

       

      I got the a problem with VB and CS5. I try to do something like that:

       

      Dim mInDesign As InDesign.Application

      Dim mPub As InDesign.Document
      Dim mHyperlink As InDesign.Hyperlink

       

      Set mInDesign = GetObject("", "InDesign.Application.CS5")
      Set mPub = mInDesign.Documents.Item(1)

      Dim mRectangle as InDesign.Rectangle

      'REM - rectangleID is a Long parameter for this function and is a valid rectangle ID

      Set mRectangle=mPub.Rectangles.ItemById(rectangleID)


      Dim mHysperSource As InDesign.HyperlinkPageItemSource
      Set mHysperSource = mPub.HyperlinkPageItemSources.Add(mRectangle)

       

      Well, the bold underlined line of code creates error 13 - type mismatch!

      No mather what I am trying to use mRectangle.AllPageItems.Item(1), mRectangle.PageItems.Item(1), mRectangle.AllGraphics.Item(1) - still no success

       

      Watching the variable shows mRectangle as Variant/Object/Rectange and mRectangle.AllGraphics.Item(1) as Variant/Object/Image

      The Image is a JPEG Image....

       

      Any suggestions how to get Hyperlinks working with Rectnagle? (I cannot use TextFrame with InsertionPoint... it is Rectangle and I cannot change it)

       

      Regards

       

      Jarema