Visio link

P

PColeman07

I am trying to create an org chart using the org chart wizard in Visio
2003. In my excel doc I have all the following fields set up (Name,
Position, Supervisor) - using the org chart wizard I am able to to
create the chart with no problem and save as html to our Intranet.
What I really need to do is automatically create a hyperlink that will
link to each job description to the appropriate shape on the org
chart. What is the best way to go about this? Is there something I
can download that will plug into visio? Thanks.
 
D

David Parker

You don't say what form the Job Description is in (html, asp, aspx, Word,
etc).
If there is a separate htm page for each different job description then it
is slightly different than if the job descriptions are accessible via asp.

Visio 2007 Professional has an easy way of creating hyperlinks, but in Visio
2003 you have to do a bit more handcrafting.

Firstly, the Org Chart Wizard only imports into Custom Properties, and
Custom Propertis do not provide a clickable hyperlink (pity!).
Secondly. you will need to prepare your Org Chart masters with a pre-defined
hyperlink row.

Create a new stencil in My Shapes and add the following sub function to a
module:
(You can then save the stencil and open it whenever you want to)

Public Sub AddLinksToOrgMasters()
Dim mst As Visio.Master
Dim shp As Visio.Shape
Dim mstClone As Visio.Master
Dim shpClone As Visio.Shape
Dim iRow As Integer
Dim hyp As Visio.Hyperlink

If Not Visio.ActiveDocument.ReadOnly = 0 Then
Exit Sub
End If

For Each mst In Visio.ActiveDocument.Masters
If mst.Shapes.Count = 1 Then
Set shp = mst.Shapes(1)
If Not shp.CellExistsU("User.SolSh", Visio.visExistsAnywhere) =
0 Then
If shp.Cells("User.SolSh").ResultStr("") =
"{0BF98B35-200C-41D5-8A23-20EF77CBC94A}" Then
If Not shp.CellExistsU("User.ShapeType",
Visio.visExistsAnywhere) = 0 Then
If shp.Cells("User.ShapeType").ResultIU > -1 And
shp.Cells("User.ShapeType").ResultIU < 7 Then
Debug.Print mst.NameU,
shp.Cells("User.ShapeType").ResultIU
Set mstClone = mst.Open
Set shpClone = mstClone.Shapes(1)
If shpClone.CellExistsU("Prop.Job",
Visio.VisExistsFlags.visExistsAnywhere) = 0 Then
iRow =
shpClone.AddNamedRow(Visio.visSectionProp, "Job", 0)
shpClone.CellsSRC(Visio.visSectionProp,
iRow, Visio.visCustPropsType).Formula = "=0"
shpClone.CellsSRC(Visio.visSectionProp,
iRow, Visio.visCustPropsLabel).Formula = "=""Job"""
shpClone.CellsSRC(Visio.visSectionProp,
iRow, Visio.visCustPropsPrompt).Formula = "=""Job"""
shpClone.CellsSRC(Visio.visSectionProp,
iRow, Visio.visCustPropsValue).Formula = "=""..."""
End If
If
shpClone.SectionExists(Visio.visSectionHyperlink, Visio.visExistsAnywhere) =
0 Then
shpClone.AddSection
Visio.visSectionHyperlink
End If
If shpClone.CellExistsU("Hyperlink.Job",
Visio.VisExistsFlags.visExistsAnywhere) = 0 Then
iRow =
shpClone.AddNamedRow(Visio.visSectionHyperlink, "Job", 0)
shpClone.CellsSRC(Visio.visSectionHyperlink,
iRow, Visio.visHLinkDefault).Formula = "=1"
shpClone.CellsSRC(Visio.visSectionHyperlink,
iRow, Visio.visHLinkDescription).Formula = "=""Job Description"""
shpClone.CellsSRC(Visio.visSectionHyperlink,
iRow, Visio.visHLinkNewWin).Formula = "=1"
shpClone.CellsSRC(Visio.visSectionHyperlink,
iRow, Visio.visHLinkAddress).Formula = "=GUARD(Prop.Job)"
End If

mstClone.Close
End If
End If
End If
End If
End If
Next mst

End Sub



Create a new Org Chart diagram (cancel the Wizard if it appears).
Open your stencil and run the code
Now use Organization Chart / Import and make sure that you have a Job column
in your Excel spreadsheet which contains hyperlinks

You will now have hyperlinks for each org shape
 

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