Visio Guy

Visio Discussions => Programming & Code => Topic started by: AndyW on January 22, 2020, 11:32:52 AM

Title: Intercept Visio Help
Post by: AndyW on January 22, 2020, 11:32:52 AM
Anyone know if it is possible for me to intercept the Visio help when the ? button is used on the title bar.
Title: Re: Intercept Visio Help
Post by: wapperdude on January 25, 2020, 12:36:41 AM
Sorry Andy, not sure what you mean by "intercept"???
Title: Re: Intercept Visio Help
Post by: Paul Herber on January 25, 2020, 12:34:54 PM
I think Andy wants to stop Visio loading its own help file when the ? button is pressed and load and display his own file.
You can certainly create an addin that has its own ribbon UI, that ribbon UI can reuse the ? icon, clicking the help icon could then load your own help file (or whatever). Not sure about adding it to what is already there.

Title: Re: Intercept Visio Help
Post by: AndyW on February 04, 2020, 03:11:39 PM
That was correct Paul, my application hides all the Visio stuff so was hoping to catch the help to redirect to mine.
Title: Re: Intercept Visio Help
Post by: Gustavo on February 12, 2020, 12:49:59 PM
As Paul said, I use a custom ribbon with the help image on it. I don't know use Add-ins.

To customize the ribbon I use, among others, the lines:
Code
<ribbon startFromScratch="true">
 <tabs>
  <tab id="msvso_helptabcustomhelp" label="Helps of my solution" insertBeforeQ="TabHome">
   <group i="msvso_customhelpgroup" label="Help Group" autoscale="false">
    <button id="msvso_customhelpbutton" label="Custom Help" onAction="Helpfilecalls.Help1" imageMso="HelpLaunch" size="large" supertip="Open custom Help file" />
   </group>
  <tab/>
 </tabs>
</ribbon>

And then, in a module called Helpfilecalls, the sub

Code
Sub Help1(control As IRibbonControl)  'Caller with the name refered of the button onAction
Select Case control.Id
 Case "msvso_customhelpbutton"   'Id of the button
  Dim Hlink As Visio.Hyperlink
  Dim shplink As Visio.Shape
  Set shplink = ActivePage.DrawLine (1, 1, 5, 5) 'Add a temp shape
  Set Hlink = shplink.AddHyperlink 'Add an hyperlinlk to the temp shape.
  Hlink.Address = "https://msdn.microsoft.com/en-us/library/office/fp161226.aspx"  'Add the hyperlink address, see function in Visio Reference to other hyperlinks syntaxes
  Hlink.Follow
  Hlink.NewWindow=False
  shplink.Delete
 End Select
End Sub

Hope it helps