export visio text to excel

J

Jerry Edwards

I have a visio org chart comprising differently coloured elements, in each of
these there is a text title. I wish to able to click on the text, then this
will open up an excel sheet. I then wish the selected text from the visio
element tro be pasted into a chosen cell in the excel sheet.
 
S

Scott Helmers

Jerry,

Creating the link to an Excel sheet is fairly simple -- select the shape to
which you want to attach the link, type CTRL+K to open the hyperlink dialog,
then navigate to the file. You can even link to a specific named cell or cell
range by including the name in the subaddress field.

To copy the text from the shape into Excel will probably require some code,
at the very least a Visio macro to extract the text then follow the
hyperlink. The sample code below does this. You can run the code by setting
the double-click behavior of the shape to run the macro; or you can assign it
to the right-click menu for the shape. Either way, it will copy the text of
the shape, link to Excel and let you paste into any cell you choose.
= = = = = = = = = = = = = =
Sub CopyTextandFollowLink()
Dim shp As Visio.Shape
Dim char As Visio.Characters
Set shp = ActiveWindow.Selection(1)
Set char = shp.Characters

char.Begin = 0
char.End = Len(shp.Text)
char.Copy

shp.Hyperlinks.Item(0).Follow
End Sub
= = = = = = = = = = = = = =

Scott
 
P

Philippe C.

It has been some time (weeks) ago I executed a Visio macro and I felt like
doing this exercise.
Some help for the novices :
The EvntDblClk becomes
=RUNMACRO("ThisDocument.CopyTextandFollowLink")

If Visio tells something lilke "This operation is currently not allowed" ->
Add text to the shape.
But how can I do this ? I just waisted my Doubleclik !?
Answer : Use the text tool, or even better : just type after the select.
 

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