3

I'm working on a VBA macro to automatically add hyperlinks within a drawing file, so that when a certain word is mentioned in the text, I can link to another page in the drawing.

According to MSDN and Visio's help, a Hyperlink object can be associated with a cell, characters, row, or section object. However, I can't find any way to actually associate a hyperlink with anything but a shape.

So the question is, how can I hyperlink a single word within a paragraph of text in a single shape in Visio?

Jon Fournier
  • 4,299
  • 3
  • 33
  • 43
  • 1
    are you reading the Hyperlink.Shape property description? I think that's a base property that's inherited by Cell, Characters, Row and Section objects, in addition to the Hyperlink object. As far as I'm aware you can only add a hyperlink to a shape. – JohnGoldsmith Jun 26 '13 at 13:22
  • Yes I was reading that description. I figured it was a long shot, that maybe there was an undocumented way to apply a hyperlink to a Characters set. – Jon Fournier Jun 26 '13 at 17:39

1 Answers1

2

I'm only familiar with two ways to trigger a hyperlink navigation within Visio:

  1. Add a Hyperlink to a shape and click on the shape (or select the hyperlink from the shape's context menu).
  2. Add a call to the Hyperlink shapesheet function in a cell formula. Making a change that triggers that cell's recalc would then follow the hyperlink.

The best idea I can think of, and it isn't very good, is:

  1. Make sure your shape is a group - if it isn't, convert it to group.
  2. Change the group's properties to SelectMode=visGrpSelModeMembers1st and DisplayMode=visGrpDisModeBack.
  3. Drop a new shape, sized and centered over the word in question. Make the new shape transparent (partial transparency here could be used for highlighting).
  4. Change the DblClick event's formula to "Hyperlink("yourURLhere")".
  5. Add that shape to the group.

Now, double-clicking on the word should actually involve double-clicking on the new subshape, which will trigger the hyperlink. This is really only viable if your shape is designed to work with this idea - many out-of-the-box shapes will not work well here, as steps 1 and 2 can have ugly side-effects.

I hope someone else knows a more elegant way around this problem.

Mike Woolf
  • 1,210
  • 7
  • 11
  • Thanks, I think this is probably the best anyone could do to get a hyperlink to work inline with text. I think what I might recommend to my colleagues is to add a label/icon on the side of the page denoting where the linked figure is, and link that icon shape. – Jon Fournier Jun 26 '13 at 17:41
  • You could also annotate the shape with an icon-style datagraphic, indicating it is clickable. – Mike Woolf Jun 28 '13 at 03:55