Hossein has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I use this package to generate a visio document.

use Win32::OLE; use Win32::OLE::Const 'Microsoft Visio';
But it seems like the package above does not offer AddHyperlink or AddHyperlinks for Perl!

Any idea how can I make a hyperlink from an object to another page within the document?

/Hossien

Replies are listed 'Best First'.
Re: AddHyperlink in Visio
by Corion (Patriarch) on Aug 27, 2013 at 11:28 UTC
      I did it now, but I can't see anything about Visio!

      $object->Hyperlinks->Add(...) does not work in Visio!

      It seems like Hyperlinks->Add or AddHyperlink doesn't exists in Visio contest!

      /Hossein

        In Visio (I have 2007) you go to the VB editor (Alt-F11), and then to the Object Browser (F2). Under classes you can see that the Shape objects have a Hyperlinks property. Again under classes you can see that the Hyperlinks objects have an Add method. I can't write some code to demonstrate this now, but this procedure should get you there with a little experimentation...

        UPDATE: Done some experiments myself. If $shape refers to some shape in the current document, then the following code creates a hyperlink, that turns up in the context menu of the shape.

        my $link = $shape->AddHyperlink(); $link->{Description} = "Google"; $link->{Address} = "http://www.google.de";

        This is a problem with Visio and not with Perl. You will then have to read the Visio documentation and find out what the appropriate method is.