Macro Help

K

Kachi

hi I recently got introduced to the wonderful world of macros in Visio
drawings.
I created a macro that would automate the hyperlink tool and make it
available under the Double Click behavior of a shape. My problem is I dont
want to create multiple macros because it seems that the code only references
the hyperlink of the original shape from which I created the macro. Is there
a way to edit the code so that each macro interation correctly references the
hyperlink of the new shape?

here is my code:
Sub kachi()
' Keyboard Shortcut: Ctrl+k
'


Application.ActiveWindow.Page.Shapes.ItemFromID(365).Hyperlinks.Item(0).Follow

End Sub

Any help you can give will be much appreciated

..
 
J

John Goldsmith

Hello Kachi,

You can set a shape 'reference to any shape you like. In the example below
I've set it to the currently selected shape (if there is one):


Sub kachi()
' Keyboard Shortcut: Ctrl+k
'
Dim shp As Visio.Shape

'Set shape reference to the first
'item in the window's selction
Set shp = ActiveWindow.Selection.PrimaryItem

'Check that something was
'actually selected
If Not shp Is Nothing Then
If shp.Hyperlinks.Count > 0 Then
shp.Hyperlinks(0).Follow
End If
End If

End Sub


You can also create this behaviour based solely on the shapesheet:

http://blogs.msdn.com:80/mailant/archive/2004/10/14/242340.aspx

Best regards

John


John Goldsmith
www.visualSignals.co.uk
 
L

Lavina

Hi

I need help. I need to do the following,I would appreciate all the help I
can get.

I am working on an Oracle TOAD Database. I need to import the columns from
TOAD to MS Visio. How do I do this?

Thanks.

Lavina
 

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