News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Auto Hyperlink

Started by Crazy Squirrel, May 04, 2022, 03:54:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Crazy Squirrel

Can't get this to work. Any ideas?

I have a rectangle to enter "Y" or "N". If "Y" is entered, I would like it to open the hyperlink.

=IF(STRSAME(SHAPETEXT(TheText),"Y"),"https://www.google.co.uk","")

(Google used as an example)

wapperdude

What do you mean by open the hyperlink?

Where is this IF statement instantiated?
Visio 2019 Pro

Crazy Squirrel

If a user enters "Y", I would like the the Hyperlink to open a file on a SharePoint site automatically, without them holding ctrl and clicking.
I had the IF statement in the Hyperlink section on the shapesheet.

wapperdude

Putting an IF statement in hyperlink section doesn't fully resolve the problem.  TheUser still needs to perform some action to trigger the IF statement.  A double click?  A right click to bring up a menu?  Hovering over the shape with the mouse? A special control shape on the page?  There will always be some initiating step by the User.  Using the <cntl> key is a flexible method built-in.  All other approaches require specific, case-by-case (for multiple hyper links) solutions.
Visio 2019 Pro

Crazy Squirrel

Thanks for clarifying that. Is it possible to have a pop up message appear if "Y" is entered, and have the hyperlink in that message?

wapperdude

Sorry, somehow I misunderstood your intentions.  I'm not aware of any way to auto trigger the hyperlink.  It isn't necessary to use the <cntl> key method.  You can also right click on the shape and then click the menu entry in the popup window.

Otherwise, it looks like it'll take some code to achieve greater automation.
Visio 2019 Pro

wapperdude

#6
Ah! A solution.  Use the HYPERLINK shapesheet function.  See https://docs.microsoft.com/en-us/office/client-developer/visio/hyperlink-function
NOTE:  This avoids creating the tranditional hyperlink that uses the <cntl> key.  I'd say this is the most efficient way to implement this.

As an example, create a User defined row and put this formula into the value cell:
=IF(STRSAME(SHAPETEXT(TheText),"Yes",),HYPERLINK("https://www.microsoft.com"),"")  If the shapetext = "Yes", the HYPERLINK will get the MS website. 

Or, alternatively, using the Actions section, enter this formula into the the Action cell: =HYPERLINK("http://visguy.com/vgforum/index.php"), and in the Menu cell, enter something like:  "_ Goto VisioGuy Forum".  This last entry will be an entry on the popup window.  Left click it and the HYPERLINK will execute.
Visio 2019 Pro

Crazy Squirrel

Wapperdude, you are a bloody Genius.  I've used you 1st option and it works perfectly.  Thank you so much.

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 286 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1105KB.
Tokens: post-login.
Cache hits: 14: 0.00268s for 26,741 bytes (show)
Cache misses: 4: (show)
Queries used: 18.

[Show Queries]