how to get the default hyper object ? so macro can invoke it fromdblClickEvent

A

art

Any Pros out there not mind sharing on how to do this ? The scratch
code here is 80 percent of the job .

Thanks,
Art

Sub hyperlink_invocation()
'
' Launch default hyperlink of the active object on active page
' not sure how to get the default hyper object though.


Dim intCounter As Integer
Dim i As Integer
Dim sel As Selection

Set sel = ActiveWindow.Selection
For intCounter = 0 To sel(1).Hyperlinks.Count - 1
If sel(1).Hyperlinks.Item(intCounter).IsDefaultLink Then
i = 1
sel(1).Hyperlinks.Item(intCounter).Follow
Else
i = 0
End If
Debug.Print intCounter, sel(1).Hyperlinks.Item(intCounter), i
Next intCounter

End Sub

' For the selection add dblclk event to call hyperlink invocation
'
Sub addDblClickBehaviorToSel()
Dim intCounter As Integer
Dim i As Integer
Dim sel As Selection

Set sel = ActiveWindow.Selection
For intCounter = 1 To sel.Count
Debug.Print intCounter, sel(intCounter).Text
'sel(intCounter).CellsSRC(visSectionObject, visRowEvent,
visEvtCellDblClick).FormulaU = "RUNMACRO
(""ThisDocument.hyperlink_invocation"")"
sel(intCounter).Cells("EventDblClick").FormulaU = "RUNMACRO
(""ThisDocument.hyperlink_invocation"")"


Next intCounter

End Sub
 
P

Paul Herber

Any Pros out there not mind sharing on how to do this ? The scratch
code here is 80 percent of the job .

Which 80% works?
1. Is the macro formula set?
2. Does the macro loop through the hyperlinks?
3. What does your code do if there is no hyperlink section or no
hyperlinks?
4. Do any of the shapes have a default hyperlink set? Just because
one of more hyperlinks exist doesn't mean that this flag is set.
5. If there is only one hyperlink then you could assume that is the
default.
 
A

art

Hi Paul,

Thanks for having a look. I'd say you're spot on on the assesment of
my code snippet. I'll have to get back to you after re-examing things.

Art

Which 80% works?
1. Is the macro formula set?
That is 10% still to be handled. I don't have good Visio documentation
or experience on this.
2. Does the macro loop through the hyperlinks? AFAIK
3. What does your code do if there is no hyperlink section or no
hyperlinks? not handled
4. Do any of the shapes have a default hyperlink set? Just because
one of more hyperlinks exist doesn't mean that this flag is set.
well, won't the field just test its not there , and handle it that
way. So the user will need to manually set the default. I choose the
default in case there were multiple links in there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top